Skip to content

feat: add keyboard shortcuts with platform-aware modifier keys#36

Merged
samzong merged 1 commit intomainfrom
feat/keyboard-shortcuts
Mar 14, 2026
Merged

feat: add keyboard shortcuts with platform-aware modifier keys#36
samzong merged 1 commit intomainfrom
feat/keyboard-shortcuts

Conversation

@samzong
Copy link
Collaborator

@samzong samzong commented Mar 14, 2026

Summary

  • Add global keyboard shortcuts: Cmd/Ctrl+Shift+O (new task), Cmd/Ctrl+Shift+F (file browser), Cmd/Ctrl+K (focus search)
  • Add send shortcut toggle (Enter vs Cmd/Ctrl+Enter) in Settings, persisted to AppConfig
  • Fix macOS shortcut detection: switch from e.key to e.code for reliable modifier+key combos
  • Fix platform-aware modifier symbol: show on macOS, Ctrl on Windows/Linux (Settings UI + ChatInput hint)

Bug Fixes

  • macOS shortcuts not firing: e.key produces unreliable values when Cmd+Shift is held; e.code uses physical key identity
  • Redundant disk write on startup: hydrating sendShortcut from config no longer triggers updateSettings() back to disk
  • Settings no-op click: toggling to the already-selected shortcut option no longer fires toast/write

Changed Files

File Change
App.tsx Global shortcut listener (e.code), hydrate sendShortcut via setState()
ChatInput.tsx Send shortcut toggle logic, platform-aware hint text
Settings/index.tsx Send shortcut toggle UI with guard, modKey interpolation
uiStore.ts SendShortcut type, setSendShortcut, searchFocusTrigger/focusSearch
LeftNav/index.tsx searchInputRef + searchFocusTrigger effect
utils.ts isMac, modKey constants
config.ts, clawwork.d.ts sendShortcut field in AppConfig/AppSettings
en.json, zh.json i18n keys with {{mod}} interpolation

Verification

tsc --noEmit passes with zero errors.

- Cmd/Ctrl+Shift+O: create new task
- Cmd/Ctrl+Shift+F: switch to file browser
- Cmd/Ctrl+K: focus search box
- Send shortcut toggle (Enter / Cmd+Enter) persisted to AppConfig
- Fix: use e.code instead of e.key for reliable macOS shortcut detection
- Fix: platform-aware modifier symbol (⌘ on macOS, Ctrl elsewhere)
- Fix: startup hydration no longer triggers redundant disk write
- Fix: Settings shortcut toggle guards against no-op clicks
@github-actions
Copy link

Hi @samzong,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@samzong samzong merged commit 367c823 into main Mar 14, 2026
4 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.

1 participant