Skip to content

feat(hotkey): add cross-platform system-wide global keyboard shortcuts - #469

Merged
lexoliu merged 3 commits into
mainfrom
feat/466-hotkey
Nov 30, 2026
Merged

lexoliu merged 3 commits into
mainfrom
feat/466-hotkey

Conversation

@lexoliu

@lexoliu lexoliu commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add waterkit-hotkey (platform/hotkey) and re-export waterkit::hotkey behind the optional hotkey feature (included in full).
  • Implement GlobalHotkey + events() stream across macOS (Carbon RegisterEventHotKey / InstallEventHandler without global state), Windows (Win32 RegisterHotKey on a dedicated message-pump thread), and Linux (Wayland org.freedesktop.portal.GlobalShortcuts portal + X11 root-window GrabKey across lock-modifier masks woken via poll(2)).
  • Report capabilities().available() == false and fail fast with HotkeyError::Unsupported on iOS, Android, and WebAssembly.

Fixes #466

Add `waterkit-hotkey` under `platform/hotkey` and re-export it from
`waterkit::hotkey` behind the `hotkey` feature (included in `full`):

- Typed `Hotkey`, `HotkeyKey` (`Logical` / `Physical`), `Modifiers`,
  `HotkeyEvent`, `HotkeyCapabilities`, and `HotkeyError`.
- macOS Carbon `RegisterEventHotKey` / `InstallEventHandler` with
  per-registration context and handler chaining (no global state).
- Windows Win32 `RegisterHotKey` (`MOD_NOREPEAT`) on an isolated
  message-pump thread with `UnregisterHotKey` on drop.
- Linux Wayland XDG Desktop Portal `org.freedesktop.portal.GlobalShortcuts`
  and X11 root-window `GrabKey` across lock-modifier masks woken via
  `poll(2)` without sleep polling.
- iOS, Android, and WebAssembly report `capabilities().available() == false`
  and fail fast with `HotkeyError::Unsupported`.

Fixes #466
@lexoliu
lexoliu merged commit 3052847 into main Nov 30, 2026
22 checks passed
@lexoliu
lexoliu deleted the feat/466-hotkey branch November 30, 2026 02:50
@github-actions github-actions Bot mentioned this pull request Nov 30, 2026
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.

hotkey: cross-platform global keyboard shortcut registration

1 participant