Is it possible to bind a (global) key press to some command and still not disrupt the key press from completing? What I mean is, if I try the bindkey solution posted elsewhere here:
# In file: ~/.xbindkeysrc
# Bind key 'q' to running 'some_command'
"some_command"
q
then the key press 'q' never completes as it otherwise would do: i.e., never prints the character 'q' on the terminal, for example.
Using xdotool to send a 'q' key press like this:
# In file: ~/.xbindkeysrc
# Bind key 'q' to running 'some_command'
"some_command && xdotool key q"
q
results in loop since the 'q' key press executed by xdotool will execute another 'some_command' via the binding.
To be a little clearer, I want the key press 'q' to execute as it normally does and in addition execute some external command. The solution above replaces the 'q' key press event with executing some external command. The problem is that if that external command also simulates a 'q' key press, then the binding re-launches the external command and I get stuck in an infinite loop.
some_commandlaunches some applications and you're trying to make it start with q pressed ? – Sergiy Kolodyazhnyy May 09 '15 at 16:18some_commandreplaces the q press. I want the q press to be executed as normal in addition tosome_commandalso being executed. Maybe this wasn't clear in the Q... – Zorawar May 09 '15 at 16:21"gnome-terminal && xdotool key q"to q and now I have infinitely spawning gnome-terminal. Is that what you're experiencing ? – Sergiy Kolodyazhnyy May 09 '15 at 16:37xdotoolsimulates another 'q' press. But then that 'q' press gets bound to opening a terminal andxdotoolsimulates another 'q' press... – Zorawar May 09 '15 at 17:12xdotool type'q' ". You've basically got infinite loop, where you press and press and press q over and over again, launching that some_command – Sergiy Kolodyazhnyy May 09 '15 at 17:39