feat(ui): add session list shortcut

This commit is contained in:
ChangeHow
2026-08-06 14:18:15 +08:00
parent 51fd947de8
commit a5d5d07d3e
15 changed files with 30 additions and 2 deletions
@@ -27,7 +27,7 @@ Component interaction keys that are not application commands, such as list navig
Bindings remain persisted as `Record<string, string>`. Each binding has one chord or at most two space-separated chords, such as `mod+s p`. `normalizeCombo`, `parseShortcut`, `formatShortcutForDisplay`, and `getShortcutConflict` provide the shared parsing and validation behavior. A single chord conflicts with a sequence sharing its first chord; sibling sequences are valid.
Contextual internal commands may deliberately share a sequence leader. The single-chord handler gets the first chance to handle the event; returning `false` lets the dispatcher start the sequence. The active file editor therefore owns `mod+s` for saving, while a mounted but unfocused editor yields `mod+s p` and `mod+s g` to the draft target pickers.
Contextual internal commands may deliberately share a sequence leader. The single-chord handler gets the first chance to handle the event; returning `false` lets the dispatcher start the sequence. The active file editor therefore owns `mod+s` for saving, while a mounted but unfocused editor yields `mod+s p`, `mod+s g`, and `mod+s l` to the draft target pickers and session list.
Runtime-specific commands may also share an exact binding when their handlers are mutually exclusive. `open_diff_panel` handles `mod+2` on desktop, while `switch_tab_2` handles it on mobile; each returns `false` outside its runtime so the dispatcher can try the next registered action.
+7
View File
@@ -55,6 +55,13 @@ const SHORTCUT_GROUPS = {
settingsLabelKey:
'settings.openchamber.keyboardShortcuts.action.open_draft_worktree_picker.label',
},
{
id: 'open_session_list',
defaultBinding: 'mod+s l',
customizable: true,
settingsLabelKey:
'settings.openchamber.keyboardShortcuts.action.open_session_list.label',
},
{
id: 'new_chat_worktree',
defaultBinding: 'mod+shift+n',
+2 -1
View File
@@ -48,9 +48,10 @@ describe('shortcut schema', () => {
))).toBe(true);
});
test('includes draft prefix bindings and session metadata', () => {
test('includes session prefix bindings and metadata', () => {
expect(getShortcutAction('open_draft_project_picker')?.defaultBinding).toBe('mod+s p');
expect(getShortcutAction('open_draft_worktree_picker')?.defaultBinding).toBe('mod+s g');
expect(getShortcutAction('open_session_list')?.defaultBinding).toBe('mod+s l');
expect(getShortcutAction('focus_input')?.category).toBe('session');
});