Global hotkeys not firing on Windows 11 even when running .py (PyQt6 overlay, F1 / Ctrl+Alt+Q unresponsive) #9255
Unanswered
stealthboy-cyber
asked this question in
Help
Replies: 2 comments 1 reply
-
|
We're not specialists in how Windows/Qt process key events. You'd be better off looking up how to format code blocks in markdown then taking your question to StackOverflow. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
FWIW, your example seems to work for me as expected when ran in my Win 11 VM. Both the callbacks and the fallback polling produce events (so I had to disable the latter to keep it from interfering with F1 toggle, or from emitting two quit events). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment
Windows 11 (10.0.26100)
Python 3.13.7
keyboard 0.13.5
(Context: PyQt6 6.9.1 overlay window, also using pynput 1.8.1 for other inputs)
Purpose / Context
I’m building a transparent, click-through PyQt6 overlay to assist with a timing-based game mini-game (e.g., FF7 Remake’s dart mini-game). The overlay shows a circular ROI and status HUD, and I need global hotkeys to toggle features (F1–F9) and to quit (Q, Ctrl+Alt+Q), regardless of focus.
Problem (not PyInstaller-specific):
Even when I run the script directly with python script.py, global hotkeys do not fire.
F1–F9 do nothing
Q / Ctrl+Alt+Q do not trigger my quit callback
When I try to quit, the overlay sometimes just drops to background (appears minimized or loses topmost) instead of exiting
This happens before packaging; i.e., it’s reproducible with plain Python. (I initially thought it was PyInstaller, but it’s not.)
What I expected
keyboard.add_hotkey("f1", ...) and keyboard.add_hotkey("ctrl+alt+q", ...) should trigger callbacks even if the overlay window is non-focusable (click-through).
keyboard.is_pressed("f1") polling should also detect the presses.
What I tried
Plain Python run (no packaging) → still broken
With/without administrator privileges (please see notes below)
Using suppress=False
Using pynput side-by-side (for other keys)
Ensuring no other hotkey tools are running
Different keyboard layouts/IME (Korean/English)
Minimal Reproducible Example
Save as overlay_minimal.py and run python overlay_minimal.py.
You should see a full-screen transparent overlay with a small status panel bottom-left.
Expected: F1 toggles a flag (and prints to console), Ctrl+Alt+Q exits.
Actual: On my machine, both are unresponsive; sometimes pressing quit keys seems to push overlay to background rather than exiting.
Questions
Are there known cases in Windows 11 where keyboard global hooks fail when the foreground app or any overlay uses special window flags (non-focusable / transparent for input)?
Are admin rights required for keyboard to hook globally in some configurations? (Any recommended check/fix?)
Any known conflicts with IME, accessibility features, or recent Windows security settings that would block low-level hooks?
Any recommended alternative approach (e.g., using a different backend) for reliable global hotkeys?
Extra notes
I see this even on the desktop without the game running.
Sometimes when trying to quit via hotkeys, the overlay seems to get pushed to background rather than exiting.
If you need, I can further trim the Qt overlay away and test a pure-console hotkey sample—please advise.

Beta Was this translation helpful? Give feedback.
All reactions