-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
The activation hotkey fires even if the user is holding additional modifier keys that are not part of the registered combination.
This makes the hotkey extremely prone to accidental activation.
Expected Behavior
The hotkey should only trigger when exactly the registered modifiers (and no extra modifiers) are pressed together with the main key.
Example (registered hotkey = Ctrl + D):
- Ctrl + D → activates ✓ (correct)
- Ctrl + Shift + D → should be ignored
- Ctrl + Alt + D → should be ignored
- Ctrl + Win + D → should be ignored
- Ctrl + Shift + Alt + D → should be ignored
Actual Behavior
Any superset of the registered modifiers still triggers the overlay:
- Ctrl + D → activates (correct)
- Ctrl + Shift + D → activates (incorrect)
- Ctrl + Alt + D → activates (incorrect)
- Ctrl + Shift + Alt + D → activates (incorrect)
- Ctrl + CapsLock + D → activates (incorrect)
Steps to Reproduce
- Set the global hotkey to Ctrl + D (or any combination that includes only some modifiers).
- Hold down an extra modifier that is not part of the registered combo (e.g. Shift, Alt, Win, CapsLock).
- Press D while still holding the extra modifier(s).
- → Overlay activates unexpectedly.
Environment
- Windows 10
Additional Notes / Likely Root Cause from AI
This is the classic mistake when using RegisterHotKey() or when manually checking modifiers in a keyboard hook:
RegisterHotKey()automatically ignores extra modifiers by design → if you're seeing this bug, the app is not usingRegisterHotKey()and is instead implementing its own low-level hook.- In a low-level keyboard hook, developers often check only
(GetAsyncKeyState(VK_CONTROL) & 0x8000)and similar for the expected modifiers, without verifying that unwanted modifiers (Shift, Alt, Win) are not pressed.
Correct implementation requires an explicit mask check, e.g.:
bool extraModifiers = (GetAsyncKeyState(VK_SHIFT) & 0x8000) ||
(GetAsyncKeyState(VK_MENU) & 0x8000) ||
(GetAsyncKeyState(VK_LWIN) & 0x8000) ||
(GetAsyncKeyState(VK_RWIN) & 0x8000);
if (extraModifiers) return; // ignoreMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working