diff --git a/app/commands.ts b/app/commands.ts index 469a5a3d7f2c..e3f9f5b0a53a 100644 --- a/app/commands.ts +++ b/app/commands.ts @@ -27,6 +27,9 @@ const commands: Record void> = { 'pane:close': (focusedWindow) => { focusedWindow?.rpc.emit('termgroup close req'); }, + 'tab:close': (focusedWindow) => { + focusedWindow?.rpc.emit('tab close req'); + }, 'window:preferences': () => { void openConfig(); }, diff --git a/app/keymaps/darwin.json b/app/keymaps/darwin.json index 30f0f2763028..fd4ee5088064 100644 --- a/app/keymaps/darwin.json +++ b/app/keymaps/darwin.json @@ -27,6 +27,7 @@ "command+alt+left", "ctrl+shift+tab" ], + "tab:close": "command+w", "tab:jump:prefix": "command", "pane:next": "command+]", "pane:prev": "command+[", diff --git a/app/keymaps/linux.json b/app/keymaps/linux.json index da66d671d7f3..9a5679137460 100644 --- a/app/keymaps/linux.json +++ b/app/keymaps/linux.json @@ -25,6 +25,7 @@ "ctrl+alt+left", "ctrl+shift+tab" ], + "tab:close": "ctrl+w", "tab:jump:prefix": "ctrl", "pane:next": "ctrl+pageup", "pane:prev": "ctrl+pagedown", diff --git a/app/keymaps/win32.json b/app/keymaps/win32.json index 8e7b19134c49..9df240086e2c 100644 --- a/app/keymaps/win32.json +++ b/app/keymaps/win32.json @@ -22,6 +22,7 @@ "tab:prev": [ "ctrl+shift+tab" ], + "tab:close": "ctrl+w", "tab:jump:prefix": "ctrl", "pane:next": "ctrl+pageup", "pane:prev": "ctrl+pagedown", diff --git a/lib/index.tsx b/lib/index.tsx index 3d62015e8b0c..20b1d8af7992 100644 --- a/lib/index.tsx +++ b/lib/index.tsx @@ -10,6 +10,7 @@ import type {configOptions} from '../typings/config'; import {loadConfig, reloadConfig} from './actions/config'; import init from './actions/index'; import {addNotificationMessage} from './actions/notifications'; +import * as headerActions from './actions/header'; import * as sessionActions from './actions/sessions'; import * as termGroupActions from './actions/term-groups'; import * as uiActions from './actions/ui'; @@ -97,6 +98,10 @@ rpc.on('termgroup close req', () => { store_.dispatch(termGroupActions.exitActiveTermGroup()); }); +rpc.on('tab close req', () => { + store_.dispatch(headerActions.closeTab(store_.getState().sessions.activeUid)); +}); + rpc.on('session clear req', () => { store_.dispatch(sessionActions.clearActiveSession()); });