I have seen How to execute a script in shell when a shortcut key is pressed, but that is not what I want.

If you have used recordmydesktop, you may have noticed the following in its manual:

After startup, it can be controled only through the following signals: SIGUSR1 causes the program to pause if it's currently recording, and vice-versa.
SIGTERM causes normal termination of the recording. [...]
See --pause-shortcut and --stop-shortcut , on the Misc. section of Options bellow. [...]
--pause-shortcut MOD+KEY
Shortcut that will be used for pausing or unpausing
the recording. [...]
Default is Control+Mod1+p (Mod1 usually corresponds
to left Alt). [...]
--stop-shortcut MOD+KEY
Shortcut that will be used to stop the recording.
For more, see -pause-shortcut above.
Default is Control+Mod1+s.

Well, I'd like the same - but for an arbitrary, typically long-running, terminal program. Say I want to use ffmpeg; then I'd want to use an application somewhat in this way (pseudocode);

$ myKeyListenerApp --start-shortcut Control+Mod1+p --stop-shortcut Control+Mod1+s ffmpeg -i mybigmovie.avi -r 24 mybigmovie.ogv

The trick would be that myKeyListenerApp would start ffmpeg "paused" (or simply not start it at all); then as soon as it is notified of the start shortcut press, it would start ffmpeg and let it do it's thing. Then when I press the stop shortcut, ffmpeg would either pause, or if that is not possible, then simply be killed, upon which myKeyListenerApp would exit, too.

Does an application like this exist?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.