Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat: register app.reopenLastClosed (Cmd+Shift+T)

Mina Samehec60590de2d4
diff --git a/src/renderer/lib/keybindingOverrides.test.ts b/src/renderer/lib/keybindingOverrides.test.ts
index 531446bc4..b5116f2d8 100644
--- a/src/renderer/lib/keybindingOverrides.test.ts
+++ b/src/renderer/lib/keybindingOverrides.test.ts
@@ -22,9 +22,9 @@ describe('activeKeybindingOverrides', () => {
})
it('sanitizes and memoizes by reference, warning once per change', () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
- setKb({ 'node.newTerminal': ['Cmd+Shift+T'], 'bogus.command': ['Cmd+X'] })
+ setKb({ 'node.newTerminal': ['Cmd+Shift+Y'], 'bogus.command': ['Cmd+X'] })
const first = activeKeybindingOverrides()
- expect(first).toEqual({ 'node.newTerminal': ['Cmd+Shift+T'] })
+ expect(first).toEqual({ 'node.newTerminal': ['Cmd+Shift+Y'] })
expect(activeKeybindingOverrides()).toBe(first)
expect(warn).toHaveBeenCalledTimes(1)
warn.mockRestore()
diff --git a/src/shared/keybindings.test.ts b/src/shared/keybindings.test.ts
index 165d7faad..38c79fda7 100644
--- a/src/shared/keybindings.test.ts
+++ b/src/shared/keybindings.test.ts
@@ -49,6 +49,13 @@ describe('registry invariants', () => {
expect(COMMANDS_BY_ID.get('canvas.fitAll')?.defaultBindings.darwin).toEqual([])
})
+ it('reopen-last-closed defaults to Cmd+Shift+T and works in a terminal', () => {
+ const def = COMMANDS_BY_ID.get('app.reopenLastClosed')
+ expect(def?.defaultBindings.darwin).toEqual(['Cmd+Shift+T'])
+ expect(def?.defaultBindings.other).toEqual(['Cmd+Shift+T'])
+ expect(def?.allowInTerminal).toBe(true)
+ })
+
it('pins the WHOLE table — every row PR 2 will dispatch on, in source order', () => {
// Source order is contractual (first match wins in the resolver), so the array order is
// asserted too. A dropped flag — allowInTerminal above all — reds this test.
@@ -79,6 +86,8 @@ describe('registry invariants', () => {
scope: 'app', darwin: ['Cmd+Shift+G'], other: ['Cmd+Shift+G'], allowInTerminal: true },
{ id: 'panel.sessions', title: 'Pin sessions sidebar', group: 'General', scope: 'app',
darwin: ['Cmd+Shift+L'], other: ['Cmd+Shift+L'], allowInTerminal: true },
+ { id: 'app.reopenLastClosed', title: 'Reopen last closed', group: 'General', scope: 'app',
+ darwin: ['Cmd+Shift+T'], other: ['Cmd+Shift+T'], allowInTerminal: true },
{ id: 'canvas.undo', title: 'Undo', group: 'Canvas', scope: 'canvas',
darwin: ['Cmd+Z'], other: ['Cmd+Z'] },
{ id: 'canvas.redo', title: 'Redo', group: 'Canvas', scope: 'canvas',
@@ -331,12 +340,12 @@ describe('findKeybindingConflicts', () => {
describe('sanitizeKeybindingOverrides', () => {
it('passes through a clean override map', () => {
- const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['Cmd+Shift+T'] }, true)
- expect(r).toEqual({ overrides: { 'node.newTerminal': ['Cmd+Shift+T'] }, warnings: [] })
+ const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['Cmd+Shift+Y'] }, true)
+ expect(r).toEqual({ overrides: { 'node.newTerminal': ['Cmd+Shift+Y'] }, warnings: [] })
})
it('canonicalizes spellings', () => {
- const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['shift+cmd+t'] }, true)
- expect(r.overrides).toEqual({ 'node.newTerminal': ['Cmd+Shift+T'] })
+ const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['shift+cmd+y'] }, true)
+ expect(r.overrides).toEqual({ 'node.newTerminal': ['Cmd+Shift+Y'] })
})
it('drops unknown ids with a warning, keeps the rest', () => {
const r = sanitizeKeybindingOverrides(
@@ -346,8 +355,8 @@ describe('sanitizeKeybindingOverrides', () => {
expect(r.warnings.some((w) => w.includes('node.selfDestruct'))).toBe(true)
})
it('drops an invalid binding string but keeps valid siblings', () => {
- const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['Cmd+Shift+T', 'T'] }, true)
- expect(r.overrides).toEqual({ 'node.newTerminal': ['Cmd+Shift+T'] })
+ const r = sanitizeKeybindingOverrides({ 'node.newTerminal': ['Cmd+Shift+Y', 'T'] }, true)
+ expect(r.overrides).toEqual({ 'node.newTerminal': ['Cmd+Shift+Y'] })
expect(r.warnings.length).toBe(1)
})
it('a non-empty list that is entirely invalid falls back to defaults, not disabled', () => {
diff --git a/src/shared/keybindings.ts b/src/shared/keybindings.ts
index 596a095f9..a612a3ee5 100644
--- a/src/shared/keybindings.ts
+++ b/src/shared/keybindings.ts
@@ -46,6 +46,7 @@ export type CommandId =
| 'panel.explorer'
| 'panel.sourceControl'
| 'panel.sessions'
+ | 'app.reopenLastClosed'
| 'canvas.undo'
| 'canvas.redo'
| 'canvas.deleteSelection'
@@ -98,6 +99,8 @@ export const COMMAND_DEFINITIONS: readonly CommandDefinition[] = [
defaultBindings: both('Cmd+Shift+G'), allowInTerminal: true },
{ id: 'panel.sessions', title: 'Pin sessions sidebar', group: 'General', scope: 'app',
defaultBindings: both('Cmd+Shift+L'), allowInTerminal: true },
+ { id: 'app.reopenLastClosed', title: 'Reopen last closed', group: 'General', scope: 'app',
+ defaultBindings: both('Cmd+Shift+T'), allowInTerminal: true },
// Canvas — inert while the kanban board is open (scope 'canvas'), blocked while typing.
{ id: 'canvas.undo', title: 'Undo', group: 'Canvas', scope: 'canvas',