pyqtkeybind icon indicating copy to clipboard operation
pyqtkeybind copied to clipboard

Numpad/keypad modifier support

Open mbdevpl opened this issue 3 years ago • 2 comments

First of all, very nice library! I've been experimenting with it this weekend, and I'd like to use it for my new project (it's gonna be open-source, I'll post a link here after I publish it).

I'm on Ubuntu 20.04, and I've been using shortcuts like Ctrl+Shift+Space or other with no problems at all -- but unfortunately, the numpad keys seem to not be supported at all by pyqtkeybind.

Code (e.g. add this line to your /sample/hotkey.py):

keybinder.register_hotkey(window.winId(), 'Num+0', window.close)

Result (at initialisation time):

Could not find a keycode for Num+0

And then, no reaction on pressing Numpad zero key.

In PyQt, along Qt.ShiftModifier, Qt.ControlModifier etc, there's a Qt.KeypadModifier -- it's useful for catching numpad/keypad events, so keypad number keys like keypad zero etc. can be recognised separately to normal zero key. E.g., Num+0 string is definitely the string for numpad zero.

I'm not sure though on the global keystroke detection side -- is numpad problematic similarly to Win key (i.e. #7) or not... But I doubt OS would get in the way of Numpad keys ;)

I think having access to numpad keys as global shortcuts is quite useful because for those that not use those keys but still have them on the keyboard (my case here), they enable creation of nice one-keystroke shortcuts.

mbdevpl avatar May 30 '21 11:05 mbdevpl