all: add media key constants for Linux (X11) and Windows#43
Merged
Conversation
Adds unified media/volume key constants (KeyMediaPlayPause, KeyMediaNext, KeyMediaPrev, KeyMediaStop, KeyVolumeUp/Down/Mute). On Linux they are XF86* keysyms and on Windows VK_MEDIA_*/VK_VOLUME_* codes; both flow through the existing XGrabKey / RegisterHotKey registration paths with no routing changes, so a media hotkey is just: hotkey.New(nil, hotkey.KeyMediaPlayPause) macOS uses a separate event mechanism for these keys and is handled in a follow-up. Towards #28.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of media-key support (#28), building on the
Key→uint32widening (#42).Adds unified media/volume constants —
KeyMediaPlayPause,KeyMediaNext,KeyMediaPrev,KeyMediaStop,KeyVolumeUp,KeyVolumeDown,KeyVolumeMute— with the same names on both platforms:XF86*keysyms (e.g.XF86AudioPlay=0x1008FF14).VK_MEDIA_*/VK_VOLUME_*codes.Both flow through the existing
XGrabKey/RegisterHotKeypaths — no routing changes — so usage is just:macOS uses a different mechanism (
NSSystemDefined/CGEventTap) for these keys and gets the same constant names in a follow-up PR with its own backend. Verified by build on all platforms + existing tests.Note: media-key behavior is not CI-verifiable on any platform (Xvfb has no media keys, Windows/macOS behavior never ran in CI) — this PR is compile-and-existing-tests verified; the registration path is the same one already exercised by the normal-key tests.