fix(app): prioritize shortcuts in terminal (#35668)

This commit is contained in:
Brendan Allan
2026-07-07 06:43:30 +00:00
committed by GitHub
parent c5fe32fbb1
commit 65fd2e5c91
3 changed files with 50 additions and 6 deletions
@@ -269,6 +269,14 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
view().terminal.open()
}
const closeTerminal = () => {
const id = terminal.active()
if (!id) return
const last = terminal.all().length === 1
void terminal.close(id)
if (last) view().terminal.close()
}
const chooseMcp = () => {
void openDialog(
() => import("@/components/dialog-select-mcp"),
@@ -518,6 +526,15 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
]
const terminalCmds = () => [
terminalCommand({
id: "terminal.close",
title: language.t("terminal.close"),
keybind: "mod+w",
hidden: true,
when: (event) =>
event.target instanceof Element && !!event.target.closest('[data-component="terminal"]'),
onSelect: closeTerminal,
}),
terminalCommand({
id: "terminal.new",
title: language.t("command.terminal.new"),