Set global shortcuts
-
I need to set shortcut for my app that works even when it's hidden or minimized.
With this library I can get what I want but it uses Qt5 which is a deal breaker for me since my app is already written in Qt6 and going back will break a lot stuff. I tried QShortcut but it only works when the app is shown and active.Is there a way to achieve this?
-
ok so you could focus on gettting
https://github.com/Skycoder42/QHotkey/blob/master/QHotkey/qhotkey_x11.cpp
to compile and just use that file/part.(assuming you are using X11 and not wieland)
You might need to do
sudo apt install libx11-dev
(or similar on your concrete linux)to get teh X11 .h files etc
-
@mrjj said in Set global shortcuts:
ok so you could focus on gettting
https://github.com/Skycoder42/QHotkey/blob/master/QHotkey/qhotkey_x11.cpp
to compile and just use that file/part.(assuming you are using X11 and not wieland)
You might need to do
sudo apt install libx11-dev
(or similar on your concrete linux)to get teh X11 .h files etc
That's what I did: I took only the needed files (namely qhotkey_x11.cpp, qhotkey_p.h, qhotkey.h and qhotkey.cpp) but I get an error in qhotkey_x11.cpp file line 51 stating :
error: field type '(anonymous namespace)::Q_QGS_hotkeyPrivate::Type' (aka 'QHotkeyPrivateX11') is an abstract class
I can't fix this.
The error refers to this line:
NATIVE_INSTANCE(QHotkeyPrivateX11)
Which is this macro in qhotkey_p.h in line 48.
I don't really understand this error.