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:\
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.
In comp.windows.x, Winston <wbe@UBEBLOCK.psr.com.invalid> wrote:
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:\
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.
The xev I have installed does not show PropertyNotify for those atoms. >Hacking xev to to catch them would be a good start to writing a C
program that monitors the clipboard.
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 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.
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).
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.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 02:52:58 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,422 |