fix: macOS shortcut handling#915
Conversation
There was a problem hiding this comment.
Very strange, I just tested it and for some reason the "super/command" + q combination does work on my laptop keyboard but not on my external keyboard. Despite being the same keys on the same side.
That being said, the changes look ok. But lets keep the shift/ctrl/alt left and right modifier keys separate. I think we should only combine the super/meta left and right keys.
I have no idea what might be causing it. I have an M1 Macbook Air. Might be some differences in the OS/drivers between variants I guess.
Should be fixed. |
PartyDonut
left a comment
There was a problem hiding this comment.
Thanks for the lightning quick fix!
I have no idea what might be causing it. I have an M1 Macbook Air. Might be some differences in the OS/drivers
between variants I guess.
M2 air here so should not be that different. I do have the international keyboard version not sure if that changes anything.
Pull Request Description
This pull request improves the flexibility and accuracy of keyboard shortcut handling by enhancing how modifier keys are compared and recognized. The main changes introduce a new method for matching modifier keys, expand support for "super" keys, and update the logic for detecting key combinations throughout the codebase.
Key combination logic improvements:
modifierMatchesstatic method toKeyCombinationto allow comparison of modifier keys by their functional group (shift, alt, ctrl, super), not just by exact key identity. This enables consistent recognition of different physical keys that serve the same modifier function (e.g., left/right shift, meta, super).containsSameSetmethod inKeyCombinationto usemodifierMatchesfor more robust comparison of key combinations.superKeys(including meta and super keys) and incorporating them into themodifierKeysset.Input handling updates:
_InputHandlerStateininput_handler.dartto useKeyCombination.modifierMatcheswhen checking if a pressed modifier key matches a configured modifier, ensuring consistent behavior with the new comparison logic.Previous PR (#901) did not fix the issue as when I tried the nightly build on my Macbook the fix did not work.
Issue Being Fixed
Resolves #882
Screenshots / Recordings
Checklist