Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.windows.x > #616

Re: Possible to be notified when the clipboard contents changes?

From Winston <wbe@UBEBLOCK.psr.com.invalid>
Newsgroups comp.windows.x
Subject Re: Possible to be notified when the clipboard contents changes?
Date 2026-02-23 17:17 -0500
Organization A noiseless patient Spider
Message-ID <ydecmbqf3m.fsf@UBEblock.psr.com> (permalink)
References <10nhjpd$2hjk6$2@news.xmission.com> <ydikbnqz2m.fsf@UBEblock.psr.com> <eli$2602231607@qaz.wtf>

Show all headers | View raw


gazelle@shell.xmission.com (Kenny McCormack) writes:
>>> I have a shell script that needs to do something if certain text
>>> shows up on the X clipboard.  It currently uses "xsel" to access the
>>> clipboard, but needs to do polling in a loop, ...

I replied (in part):
>> I don't know for sure, but, for compiled code, have a look at:
>>         man 3 XInternAtom
>>         man 3 XGetWindowProperty
>> and PropertyNotify events
>> for the atoms 0(CUT_BUFFER0) and XA_PRIMARY.

Eli the Bearded <*@eli.users.panix.com> replied (in part):
> The xev I have installed does not show PropertyNotify for those atoms.

Just tried something: Running "xev -root | fgrep Property" in an xterm,
then mouse selecting a word in any xterm window, reports a
PropertyNewValue event for CUT_BUFFER0.

However, no event was reported when the selection was lost, nor did
deletion in Emacs (which sets something typically used by "paste")
report an event, so this solution looks incomplete (it probably needs
to test XA_PRIMARY).
 -WBE

Back to comp.windows.x | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Possible to be notified when the clipboard contents changes? gazelle@shell.xmission.com (Kenny McCormack) - 2026-02-23 13:13 +0000
  Re: Possible to be notified when the clipboard contents changes? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2026-02-23 10:06 -0500
    Re: Possible to be notified when the clipboard contents changes? Eli the Bearded <*@eli.users.panix.com> - 2026-02-23 21:08 +0000
      Re: Possible to be notified when the clipboard contents changes? gazelle@shell.xmission.com (Kenny McCormack) - 2026-02-23 21:19 +0000
      Re: Possible to be notified when the clipboard contents changes? Winston <wbe@UBEBLOCK.psr.com.invalid> - 2026-02-23 17:17 -0500
        Re: Possible to be notified when the clipboard contents changes? gazelle@shell.xmission.com (Kenny McCormack) - 2026-03-02 22:02 +0000

csiph-web