Monday, April 29, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 1156  / 1 Year ago, wed, march 29, 2023, 11:31:07

I'm writing a Notational Velocity clone for Gnome/Ubuntu using Quickly (PyGI) and I want to allow users to set a global shortcut key that will toggle the visibility of the app window when the app is running (something like Tilda does for its terminal emulator). I.e., once the app is launched, a user could press F2 to hide the window, and then press F2 again to make it visible and bring it to the front. I don't want to use an external hotkey app or anything that requires out-of-app settings. How would I go about this?



There's a similar question here: How can I listen on global keypress event? but the main answer there is a cludgy non-programmatic solution. One commenter mentions "grabbing the keyboard with an X api call" but I'm not sure where to start with that.


More From » shortcut-keys

 Answers
2

The Keybinder library does exactly this. If you check pull requests there are requests in for examples using pygi, one of which is me for py3k.


[#36670] Thursday, March 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
riffnkful

Total Points: 390
Total Questions: 123
Total Answers: 110

Location: Puerto Rico
Member since Sat, Mar 13, 2021
3 Years ago
;