stackity stackity - 1 month ago 13
Python Question

Python Global Hotkey

I'm looking to create a global hotkey in Python 3.2 for Ubuntu 12.10. That is, my script will run in the background and whenever I press shift + F4 (for example), no matter what the active window is, the script will do something.

These are the

I've looked at (had to paste them in Pastebin since Stack Overflow only allows me to post two links)

Maybe I am too much of a newb (I am a beginner) or I have been looking in the wrong places or for the wrong things, but, I haven't been able to utilize the resources above.

How can I create a global hotkey with Python 3.2 in Ubuntu 12.10. Thanks!

ps: This is a duplicate of

Answer Source

Take a look at; it's a simple library that proclaims to enable global keyboard shortcuts and includes Python bindings. It's specific to GTK, but if your target is Ubuntu most Ubuntu systems are using Gnome and GTK-based applications by default. YMMV outside of GTK windows, in which case you'll have to use some lower-level X11 calls.