uLaunch | source qlaunch ( Nintendo Switch HOME menu
kandi X-RAY | uLaunch Summary
kandi X-RAY | uLaunch Summary
Custom, open-source replacement/reimplementation for Nintendo Switch's HOME menu (qlaunch), extending it with amazing, homebrew-oriented functionality!. uLaunch is a very ambitious project, consisting on two custom library applets, a custom system application and a custom system applet, in order to replace the console's HOME menu with a custom, homebrew-oriented one.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of uLaunch
uLaunch Key Features
uLaunch Examples and Code Snippets
Community Discussions
Trending Discussions on uLaunch
QUESTION
I am creating a launcher, in the style of Albert, Alfred or uLauncher. My application runs in the background and shows up when a hotkey is pressed. I use pynput
to listen to hotkeys. I cannot use PyQt5 hotkey's feature (can't I?) because I need to listen to keyboard events in the system scope, not only the application's scope.
When the shortcut is pressed, it calls the show() method of my widget. The only issue is that I can't get the focus back on my window, despite the use of raise_
, setFocus
and activateWindow
.
I found a (ugly) workaround that consists in openning a QMessageBox (+ tweaking its appearance to make it invisible, but I didn't put that in the example code) and closing it immediately after.
When I was working on Linux, that workaround was doing the job, and I was ready to forget how ugly it is for it does the job. But I switched to Windows (on which my app must run too), and now this cheeky trick seems to cause freeze then crash of my application. Karma? For sure.
Any ways, my application is useless if it cannot catch focus, so I'm asking two questions, and I'd be happy with only one being solved. :)
- Do you know why showing the QMessageBox causes a crash?
- Do you know any other way to get the focus back on my application?
Here is an example code to play with.
Thank you very much :)
EDIT: I just found out that even with deactivating the QMessageBox workaround, the application eventually crashes (after 5, 20, 30 calls of the hotkey). So the issue might as well be in the way I bind my shortcut to the GUI, I fear a thread issue, but this is way beyond my knowledge :/
...ANSWER
Answered 2021-Jan-15 at 10:14I found my error, so I'm posting an updated piece of code here for it could be helpful to anyone trying to bind a global hotkey to a function that affects a GUI, aka two different thread communicating.
My mistake was indeed to bind the hotkey triggered action straight to my show()
method, which implies that the pynput
listenner thread will attempt to communnicate with the QApplication
.
The trick is to use a pyqtSignal()
and to ask it to trigger the show()
method. The signal itself being trigger by the hotkey.
After doing that in a clean way, my cheeky_focus_stealer
works again, because it is ran from the GUI thread.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install uLaunch
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page