Groups | Search | Server Info | Login | Register
Groups > comp.windows.x > #613
| 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 10:06 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ydikbnqz2m.fsf@UBEblock.psr.com> (permalink) |
| References | <10nhjpd$2hjk6$2@news.xmission.com> |
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, like this:\
>
> while :; do clip="$(xsel)"; [[ "$clip" =~ something ]] && do_something;sleep 3;done
>
> This works OK, but it'd be better if it didn't need to poll. Is there any
> event-ish way to do this?
>
> I looked at a few of the clipboard-related utilities available - xcutsel
> and xclipboard - but didn't find anything interesting.
>
> BTW, if there is a way to do this that involves C programming
> (writing/compiling something with X lib calls), I am open to that.
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.
-WBE
Back to comp.windows.x | Previous | Next — Previous in thread | Next in thread | Find similar
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