feat(shortcuts): add configurable number-key navigation#2838
Open
luisKisters wants to merge 9 commits into
Open
feat(shortcuts): add configurable number-key navigation#2838luisKisters wants to merge 9 commits into
luisKisters wants to merge 9 commits into
Conversation
Cmd+1-9 jumps to the Nth task in sidebar order (pinned first, then the project tree top to bottom). Control+1-9 jumps to the Nth tab in the focused pane, left to right, replacing the previously hardcoded Mod+1-9 tab bindings. Both families are debounced (200ms leading edge), configurable and disableable in Settings via new tabByNumber and taskByNumber shortcut entries, and suppressed in Monaco when flagged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… add hold hints Digit shortcuts died once focus moved into a browser webview or an xterm terminal (the 'Ctrl+1-2 work, Ctrl+3+ dead' symptom): webviews swallow keys before the renderer sees them and xterm maps Ctrl+2-8 to control characters. Forward matching digit presses from browser webContents via a new numberShortcutChannel (mirroring the Control+Tab path) and route terminal digit chords through dispatchMatchingHotkeys like tab navigation. The debounce claim is shared module-wide and measured on event timestamps so key-repeat is swallowed even under render load. Holding the shortcut modifier (default Cmd for tasks, Ctrl for tabs) now reveals 1-9 hint badges on sidebar tasks and pane tabs for discoverability. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…inds Review fixes: the debounce now keys on family+digit so distinct rapid presses all fire while key-repeat is still swallowed; hint badges render the full keycap chord (e.g. ⌘1) via the shared Shortcut component and stay visible across consecutive jumps within one modifier hold; invalid number-family rebinds fall back to the default binding instead of silently disabling the family (shared resolveNumberFamilyBase used by renderer, Monaco bridge, and browser forwarding); sidebar order for jumps and badges comes from a single numberedTaskEntries source; webview forwarding emits every matching family; taskByNumber allows conflicts like its tab sibling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Hint badges float on the right edge of task rows and tab chips instead of reflowing content: an absolutely positioned overlay whose leftward gradient matches the row background per state (default/hover/active), so underlying markers fade out beneath the keycap while the modifier is held. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the two base-plus-derived-digits family entries with eighteen standalone APP_SHORTCUTS entries (task1-9, tab1-9), so Settings lists 'Jump to 1st Task' through 'Jump to 9th Tab' and each digit can be rebound or disabled on its own — including to non-digit keys. The webview forwarding matches each configured binding exactly, hint badges show each entry's own effective hotkey, the reveal modifier comes from the first enabled binding of a family, and the Monaco bridge works through the plain per-key ignore path again. Drops getNumberHotkeys / resolveNumberFamilyBase / numberFamily. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR adds configurable number-key navigation for tasks and tabs. The main changes are:
Confidence Score: 5/5The changed flow looks mergeable after small cleanup to hint state and terminal conflict behavior.
apps/emdash-desktop/src/renderer/lib/hooks/use-number-hotkeys.ts; apps/emdash-desktop/src/renderer/lib/hooks/use-modifier-held.ts
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/core/browser/browser-webcontents-registry.ts | Adds browser webContents forwarding for number shortcuts and modifier state. |
| apps/emdash-desktop/src/renderer/lib/hooks/use-number-hotkeys.ts | Adds shared number shortcut binding, debounce, and terminal dispatch helpers. |
| apps/emdash-desktop/src/renderer/lib/hooks/use-modifier-held.ts | Adds delayed modifier-held tracking for shortcut hint overlays. |
| apps/emdash-desktop/src/renderer/features/sidebar/sidebar-store.ts | Adds a single numbered task order for shortcuts and hint badges. |
| apps/emdash-desktop/src/shared/shortcuts.ts | Adds task and tab number shortcut definitions and ordered key arrays. |
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/emdash-desktop/src/renderer/lib/hooks/use-number-hotkeys.ts:45
**Terminal Dispatch Uses Global Order**
When a task number shortcut and a tab number shortcut are rebound to the same key, terminal input goes through this `dispatch: 'first'` path instead of the normal focused document handler. The first enabled global registration wins by manager insertion order, so a focused terminal can navigate to a sidebar task instead of switching the focused pane tab, or the reverse.
### Issue 2 of 2
apps/emdash-desktop/src/renderer/lib/hooks/use-modifier-held.ts:97-104
**Held State Survives Rebinding**
When the configured reveal modifier changes while hints are visible, the old effect cleanup removes listeners and clears the timer but leaves `held` as `true`. The next shortcut family can show its hint overlay immediately even though the new modifier was never held.
```suggestion
return () => {
window.removeEventListener('keydown', onKeyDown, true);
window.removeEventListener('keyup', onKeyUp, true);
window.removeEventListener('blur', cancel);
stopForwardedModifier();
stopForwardedShortcut();
if (timer !== null) window.clearTimeout(timer);
setHeld(false);
};
```
Reviews (1): Last reviewed commit: "fix(shortcuts): refine number navigation..." | Re-trigger Greptile
# Conflicts: # apps/emdash-desktop/src/renderer/features/browser/browser-pane.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds configurable number-key navigation for tasks and pane tabs.
Command+1-9for pane and conversation tabs on macOS, preserving the familiar tabnavigation behavior.
Control+1-9for sidebar tasks on macOS. Windows and Linux useMod+1-9for tabs andAlt+1-9for tasks to avoid conflicts.arbitrary non-digit rebindings.
soon as a shortcut is used so the gradient does not linger during navigation.
Related issues
No issue linked.
Testing
pnpm --filter @emdash/emdash-desktop exec vitest run --project node src/shared/shortcuts.test.ts src/main/core/browser/browser-webcontents-registry.test.ts src/renderer/lib/hooks/use-number-hotkeys.test.ts(25 tests passed)oxlintacross all changed TypeScript filesoxfmt --checkacross all changed TypeScript filespnpm --filter @emdash/emdash-desktop exec tsgo --noEmitgit diff --check origin/main...HEADScreenshot/Recording
Task & Conversation switching
Screen.Recording.2026-07-12.at.16.36.58.mov
Configurable task and tab bindings
Checklist