Skip to content

all: add media key constants for Linux (X11) and Windows#43

Merged
changkun merged 1 commit into
mainfrom
feat/media-keys-x11-windows
Jun 6, 2026
Merged

all: add media key constants for Linux (X11) and Windows#43
changkun merged 1 commit into
mainfrom
feat/media-keys-x11-windows

Conversation

@changkun

@changkun changkun commented Jun 6, 2026

Copy link
Copy Markdown
Member

Part of media-key support (#28), building on the Keyuint32 widening (#42).

Adds unified media/volume constants — KeyMediaPlayPause, KeyMediaNext, KeyMediaPrev, KeyMediaStop, KeyVolumeUp, KeyVolumeDown, KeyVolumeMute — with the same names on both platforms:

  • Linux: XF86* keysyms (e.g. XF86AudioPlay = 0x1008FF14).
  • Windows: VK_MEDIA_* / VK_VOLUME_* codes.

Both flow through the existing XGrabKey / RegisterHotKey paths — no routing changes — so usage is just:

hk := hotkey.New(nil, hotkey.KeyMediaPlayPause)

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.

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.
@changkun changkun merged commit 40661d1 into main Jun 6, 2026
19 checks passed
@changkun changkun deleted the feat/media-keys-x11-windows branch June 6, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant