How can I programatically show/hide my app window with global shortcut key?

monotasker

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.

RobotHumans

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I programatically show/hide my app window with global shortcut key?

From Dev

How can I add my app shortcut to notification panel

From Dev

How can I open a file I've added to my Windows Store App project programatically?

From Dev

How can i make my .desktop app global?

From Dev

How can I center a window with a keyboard shortcut?

From Dev

How can I bind the Enter key to my tkinter window

From Dev

How can I execute a shortcut in my path

From Dev

How can I reorder my UINavigationController items programatically?

From Dev

Linux Mint: How can I run a script with root privileges via a key shortcut without entering my password?

From Dev

In my Ember.js app, how can I define a global config value that can be referenced in my templates?

From Dev

Can I programatically open a new query window?

From Dev

How can I add my application's shortcut to the homescreen upon app installation?

From Dev

How can I create a shortcut to resize panes in a tmux window?

From Dev

How can I make a shortcut to raise an application's window if it exists?

From Dev

How can I toggle two finger touchpad with a custom shortcut key?

From Dev

How can I bind a key shortcut that includes a tab

From Dev

How can I quickly toggle monitor orientation with a shortcut key?

From Dev

How can I increase the size of my window?

From Dev

How can I sign my Windows Store app from Window Store certificate?

From Dev

How can I create a keyboard shortcut to open a document, not just an app?

From Dev

How can I start the "Emojy & Symbols" app with a Keyboard Shortcut?

From Dev

How can I block a keyboard shortcut being sent to a Windows app?

From Dev

How can I disable a Widows 7/8.1/10 shortcut key WITHOUT disabling ALL shortcut keys?

From Dev

I want to show my window when the keyboard shortcut - show desktop has invoked,is there any function can get this?

From Dev

Can I get the window that loses focus because my app starts?

From Dev

How can I programatically determine where my C++ runtime libraries are?

From Dev

How can I make my excel formulas calculate after values have been added programatically

From Dev

How can I restart a service in android programatically?

From Dev

How can I programatically tap an AppBarButton?

Related Related

  1. 1

    How can I programatically show/hide my app window with global shortcut key?

  2. 2

    How can I add my app shortcut to notification panel

  3. 3

    How can I open a file I've added to my Windows Store App project programatically?

  4. 4

    How can i make my .desktop app global?

  5. 5

    How can I center a window with a keyboard shortcut?

  6. 6

    How can I bind the Enter key to my tkinter window

  7. 7

    How can I execute a shortcut in my path

  8. 8

    How can I reorder my UINavigationController items programatically?

  9. 9

    Linux Mint: How can I run a script with root privileges via a key shortcut without entering my password?

  10. 10

    In my Ember.js app, how can I define a global config value that can be referenced in my templates?

  11. 11

    Can I programatically open a new query window?

  12. 12

    How can I add my application's shortcut to the homescreen upon app installation?

  13. 13

    How can I create a shortcut to resize panes in a tmux window?

  14. 14

    How can I make a shortcut to raise an application's window if it exists?

  15. 15

    How can I toggle two finger touchpad with a custom shortcut key?

  16. 16

    How can I bind a key shortcut that includes a tab

  17. 17

    How can I quickly toggle monitor orientation with a shortcut key?

  18. 18

    How can I increase the size of my window?

  19. 19

    How can I sign my Windows Store app from Window Store certificate?

  20. 20

    How can I create a keyboard shortcut to open a document, not just an app?

  21. 21

    How can I start the "Emojy & Symbols" app with a Keyboard Shortcut?

  22. 22

    How can I block a keyboard shortcut being sent to a Windows app?

  23. 23

    How can I disable a Widows 7/8.1/10 shortcut key WITHOUT disabling ALL shortcut keys?

  24. 24

    I want to show my window when the keyboard shortcut - show desktop has invoked,is there any function can get this?

  25. 25

    Can I get the window that loses focus because my app starts?

  26. 26

    How can I programatically determine where my C++ runtime libraries are?

  27. 27

    How can I make my excel formulas calculate after values have been added programatically

  28. 28

    How can I restart a service in android programatically?

  29. 29

    How can I programatically tap an AppBarButton?

HotTag

Archive