feat(desktop): make the toggle-window global shortcut customizable by cwyptt · Pull Request #2040 · SableClient/Sable · GitHub
Skip to content

feat(desktop): make the toggle-window global shortcut customizable - #2040

Merged
eleboucher merged 4 commits into
SableClient:devfrom
cwyptt:feat/toggle-global-window-close
Sep 6, 2026
Merged

feat(desktop): make the toggle-window global shortcut customizable#2040
eleboucher merged 4 commits into
SableClient:devfrom
cwyptt:feat/toggle-global-window-close

Conversation

@cwyptt

@cwyptt cwyptt commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Surface the global show/hide window shortcut in Settings → Keyboard Shortcuts under a new Global section (desktop only, listed last). The binding is now user-configurable like every other shortcut: rebindable, clearable (Backspace or Reset disables it), and persisted in desktop-preferences.json via the new set_toggle_window_shortcut command, which registers/unregisters the OS accelerator and re-registers it at startup. DesktopRuntimeState reports the live binding to the webview.

Motivation: the accelerator was previously hardcoded (CmdOrCtrl+Shift+S), invisible in the shortcuts UI, and always on. It is now off by default, an intentional behavior change, and OS-level bindings conflict-check against every scope, since the OS intercepts the combo before the webview sees it. Registration failures surface inline, including a clear refusal on Wayland sessions (the global-hotkey crate is X11-only; its XWayland grab cannot intercept compositor key events).

No new dependencies.

Verification: cargo test --lib (138 passed), pnpm typecheck, pnpm test -- --run (3244 passed), pnpm lint, all clean.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

Converts existing hotkey format to Tauri's OS-level hotkey format, persists these OS-level/desktop-only preferences in desktop-preferences.json. Warns on edit when on Wayland session as these Global keybinds aren't supported from Tauri's side. Adds a new Global category tagged desktopOnly (does not show on Web or Mobile, obviously).

  • Tests on both sides: accelerator conversion/validation, Wayland guard, sanitizer stripping, conflict scope, capture/reset/disable/error flows, section ordering and non-desktop hiding.

Surface the global show/hide window shortcut in Settings → Keyboard
Shortcuts under a new Global section (desktop only). The shortcut is
off by default; users can bind any key combination or disable it
entirely. Bindings persist through the new set_toggle_window_shortcut
command and are re-registered at startup. OS-registered shortcuts
collide with bindings in every scope, since the OS intercepts key
presses before the webview sees them.
global-hotkey has no Wayland backend: its X11 grab lives in XWayland
and only sees key presses while an X11 window is focused, so
registration succeeds silently but never fires on Wayland. Refuse the
binding with an explanatory error on Linux when WAYLAND_DISPLAY is
set, and surface the backend error message verbatim in the shortcuts
UI instead of a generic fallback.
…ding

The Keyboard Shortcuts page now leads with the in-app sections and
places Global last, with its system-wide explanation as a caption
under the Global heading. Reword the intro to say "App-wide" instead
of "Global" shortcuts, since Global now names a section whose
shortcuts do run while typing.
@eleboucher
eleboucher merged commit 26e7282 into SableClient:dev Sep 6, 2026
15 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.

2 participants