I would like to detect if a key is being pressed when running a script. I have the following script:
#!/bin/bash
sleep 0.5
xte 'str sometext'
I run this script using a shortcut to paste "sometext" where I'm at in kde. I used a sleep 0.5 here because the script itself is run with a shortcut that uses ctrl and alt. If the sleep 0.5 is omitted, the result is that ctrl+s, ctrl+o, etc... is sent. I think the solution would be to add some bussy wait at the beginning that would block untill no keys are being pressed. How can I get this to work in the script?
Asked by Silverrocker
(1865 rep)
Oct 11, 2012, 03:36 PM
Last activity: Dec 9, 2016, 05:52 PM
Last activity: Dec 9, 2016, 05:52 PM