timeyyy/system_hotkey

Ubuntu 21 globality problem

Opened this issue · 1 comments

Hello!

I am trying to use the package on Ubuntu 21.04, and it seems the "globality" of the hotkeys is very much reduced there.

The simplistic example, which at the heart is

hk = SystemHotkey()
hk.register(('control', 'shift', 'h'), callback=lambda x:print("Easy!", x))

will not receive keystrokes, except when the corresponding widget has focus (I am embedding this in a Qt application), i.e. not even when the corresponding parent console window receives input.

Is there any idea how I could get across this to keep using system-hotkey - did I miss anything?

Thank you!


A 'working' snippet (well it works on Ubuntu 18/20) to allow for reproducing the behaviour:

from PySide2.QtWidgets import QApplication, QDialog
from system_hotkey import SystemHotkey


hk = SystemHotkey()
hk.register(('control', 'shift', 'h'), callback=lambda x:print("Easy!", x))


app = QApplication()
dialog = QDialog()
# dialog.setTitle("mittudomen?")
dialog.show()
app.exec_()

(PySide2/Qt 5.15.2 and system-hotkey 1.0.3 are involved)

All right, sorry. I have began to process the information that Ubuntu 21 is based on Wayland, and Wayland does not - for security considerations - allow client applications to register global hotkeys.

I would like to hold myself back from commenting on how this is carried out by the Wayland maintainers (?), and for how long, but I expect that probably there won't be any solution in the scope of the system-hotkey package for this too soon.

Anyway, many thanks for the package so far!