How to create a global hotkey?

Paul Boddie paul at boddie.org.uk
Fri Dec 8 12:19:36 EST 2006


k04jg02 at gmail.com wrote:
> Sorry, I should have mentioned that I'm running Linux, and I only will
> be running this app while X is running.

Global "hot keys" are typically the domain of the desktop environment
(or window manager for archaic desktops). For example, KDE has a
configuration dialogue where you can define hot keys or key
combinations that do particular things: I've got the Windows key doing
useful stuff in combination with other keys, for example.

So programmatically setting hot keys may be something that requires
communication with the desktop environment, and it would appear that on
KDE you have to put hot key definitions in a file and then import them,
the latter possibly being achieved using the DCOP interprocess
communications mechanism provided in the environment (try "dcop
khotkeys khotkeys" at the shell). Here's the only documentation I've
found so far:

http://developer.kde.org/~seli/khotkeys/

I suppose you could just plug in at the X level and have something
define and intercept a hot key before the desktop environment has a
chance to process it, but I doubt that this would be a particularly
nice solution.

Paul




More information about the Python-list mailing list