Skip to content

fix: register agent hotkey as independent GNOME Wayland keybinding slot#436

Merged
gabrielste1n merged 2 commits intoOpenWhispr:mainfrom
alumpe:al/agent-hotkey-registration-gnome
Mar 18, 2026
Merged

fix: register agent hotkey as independent GNOME Wayland keybinding slot#436
gabrielste1n merged 2 commits intoOpenWhispr:mainfrom
alumpe:al/agent-hotkey-registration-gnome

Conversation

@alumpe
Copy link
Contributor

@alumpe alumpe commented Mar 14, 2026

On GNOME Wayland, Electron's globalShortcut API is blocked by the Wayland security model. OpenWhispr works around this for the dictation hotkey via native GNOME keybindings (gsettings + D-Bus), but the agent hotkey was never wired into that same system — so it silently failed to register on GNOME Wayland.

Changes

Important

registerSlot() had to be made async because the GNOME keybinding path calls into gnomeManager.registerKeybinding(), which is async. Without awaiting it, callers would receive an unresolved Promise instead of the actual { success, message } result, silently swallowing registration failures.

  • gnomeShortcut.js: Added per-slot gsettings paths (openwhispr for dictation, openwhispr-agent for agent) and a ToggleAgent D-Bus method alongside the existing Toggle, so each hotkey slot gets its own independent GNOME keybinding
  • hotkeyManager.js: registerSlot() is now async and routes non-dictation slots through GNOME keybindings instead of globalShortcut
  • ipcHandlers.js / main.js: Agent hotkey registration now awaits the result and handles failures
  • settingsStore.ts: setAgentKey() uses the new updateAgentHotkey invoke (request/response) instead of fire-and-forget notifyAgentHotkeyChanged, and rolls back the stored value on failure
  • preload.js / electron.ts: New updateAgentHotkey IPC bridge with typed return value

Before
Agent hotkey appeared to save but never triggered on GNOME Wayland.

After
Both dictation and agent hotkeys register as separate named shortcuts, visible in GNOME Settings → Keyboard → Shortcuts → Custom.

alumpe and others added 2 commits March 14, 2026 22:59
Rollback to previous agentKey value instead of blanking on registration
failure. Remove the deprecated agent-hotkey-changed fire-and-forget
channel — update-agent-hotkey (invoke) fully replaces it.
@gabrielstein-mem0
Copy link

Nice work! The per-slot GNOME keybinding architecture is clean and the async error propagation is a solid improvement over the silent failures before.

Pushed a small follow-up commit that:

  • Restores the previous agent hotkey on registration failure instead of blanking it (so users don't lose a working hotkey if a change fails)
  • Removes the old fire-and-forget agent-hotkey-changed IPC channel since update-agent-hotkey fully replaces it

LGTM — ready to merge.

@gabrielste1n gabrielste1n merged commit c52fd7a into OpenWhispr:main Mar 18, 2026
6 checks passed
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.

3 participants