feat(native): system-wide PTT/deafen via a non-consuming key poll (#2)
Build Lotus Chat Desktop / prepare (push) Successful in 3s
Build Lotus Chat Desktop / build-windows (push) Canceled after 0s
Build Lotus Chat Desktop / build-linux (push) Canceled after 0s
Build Lotus Chat Desktop / build-arch (push) Canceled after 0s
Build Lotus Chat Desktop / update-manifest (push) Canceled after 0s

PTT and deafen are DOM key handlers in cinny and only fire while the Lotus
window has focus — alt-tab into a fullscreen game and the voice controls
stop working.

New native/hotkeys.rs (Windows): `set_global_hotkeys(bindings)` starts a
thread that samples GetAsyncKeyState for the configured W3C key codes every
~8 ms while a call is joined and emits a `lotus-global-hotkey` DOM event
{id, state, ctrl, alt, meta} on each press/release transition; an empty
list stops it. Deliberately NOT RegisterHotKey / a global-shortcut plugin:
those consume the key system-wide (a bare Space PTT would stop every other
app typing spaces). `global_hotkeys_supported` reports false off Windows,
where the commands are no-ops (Linux X11 could poll XQueryKeymap later;
Wayland has no non-consuming path). HotkeyPoll state is managed
unconditionally in setup. Cargo: Win32_UI_Input_KeyboardAndMouse feature.
Cross-checked against windows 0.61 for x86_64-pc-windows-msvc; Linux
cargo check clean.

Web side: cinny 00584d78 (useCallHotkeys + Settings → Calls toggle).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-17 13:40:57 -04:00
co-authored by Claude Opus 5
parent a5540b8246
commit 4d0cfaa194
4 changed files with 244 additions and 0 deletions
+7
View File
@@ -519,6 +519,8 @@ pub fn run() {
native::chrome::window_start_drag,
native::chrome::window_close,
native::toast::show_rich_toast,
native::hotkeys::global_hotkeys_supported,
native::hotkeys::set_global_hotkeys,
])
.plugin(tauri_plugin_localhost::Builder::new(port).build())
.plugin(
@@ -553,6 +555,11 @@ pub fn run() {
builder
.setup(move |app| {
// cinny-desktop #2: system-wide PTT/deafen poll state (idle until the
// web side registers bindings on call join). Managed unconditionally
// so the commands can never hit a missing-state panic.
app.manage(native::hotkeys::HotkeyPoll::default());
// --- System tray: keeps Lotus Chat running in the background so
// notifications keep arriving after the window is closed-to-tray. ---
// Degrade gracefully if the bundled icon is missing rather than