Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add shortcuts for terminal close and chat with same Git state #56

Mergedjuliusmarmingemerged 3 commits intomain fromcodething/48203257merged by juliusmarminge View on GitHub

Showing 9 changed files with 43 additions and 9 deletions (loading 6).

x
0 of 9 viewed, 9 left
4 additions and 1 deletionapps/server/src/keybindings.tsModified
View file
@@ -28,7 +28,10 @@
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },
{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },
- { key: "mod+shift+o", command: "chat.new" },
+ { key: "mod+w", command: "terminal.close", when: "terminalFocus" },
Thread on line 31
greptile-apps[bot](GitHub profile, opens in a new tab)commented

mod+w conflicts with browser tab-close

Cmd+W / Ctrl+W is the standard shortcut for closing a browser tab. While the terminalFocus guard limits when this fires, most browsers do not allow JavaScript to intercept and preventDefault() on Ctrl+W/Cmd+W — the tab will still close.

This should work fine in Electron (where the app controls key event routing), but in the browser-served mode the shortcut will effectively be unusable and may cause unexpected tab closures. If the app is meant to run in both contexts, consider choosing a different default binding for browser users (e.g. mod+shift+w).

+ { key: "mod+n", command: "chat.new", when: "!terminalFocus" },
+ { key: "mod+shift+o", command: "chat.new", when: "!terminalFocus" },
+ { key: "mod+shift+n", command: "chat.newLocal", when: "!terminalFocus" },
{ key: "mod+o", command: "editor.openFavorite" },
];
​
16 additions and 0 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -52,6 +52,7 @@
import GitActionsControl from "./GitActionsControl";
import {
isOpenFavoriteEditorShortcut,
+ isTerminalCloseShortcut,
isTerminalNewShortcut,
isTerminalSplitShortcut,
isTerminalToggleShortcut,
@@ -278,6 +279,10 @@
() => shortcutLabelForCommand(keybindings, "terminal.new"),
[keybindings],