I have a script that is executed periodically in the background. I want to prevent its execution if the Shift key is pressed.
The idea is to poll the keyboard's Shift button state, and if it's pressed — terminate the script immediately.
Any ideas? X server is allowed to use: I guess it will help.
UPD: I'm currently using this stupid hack:
[ $( sh -c 'cat /dev/input/by-id/usb-*kbd & sleep 0.5 ; kill $! 2>/dev/null' | wc -c ) -gt 1 ] && exit
The script just detects current keyboard events but does not distinguish them. 0.5sec is the kbd-events watch period. Not very nice, but still works :)