Skip to content

Commit 99f1532

Browse files
committed
feat(terminal): add F4 shortcut and auto-focus on panel shown
- Add F4 keyboard shortcut for view.terminal command - Listen for EVENT_PANEL_SHOWN to focus terminal when panel becomes visible
1 parent 003bddb commit 99f1532

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/base-config/keyboard.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@
290290
"view.toggleProblems": [
291291
"Ctrl-Shift-M"
292292
],
293+
"view.terminal": [
294+
"F4"
295+
],
293296
"navigate.jumptoDefinition": [
294297
"Ctrl-J"
295298
],

src/extensionsIntegrated/Terminal/main.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ define(function (require, exports, module) {
136136
// Listen for panel resize
137137
WorkspaceManager.on("workspaceUpdateLayout", _handleResize);
138138

139+
// Focus terminal when the panel becomes visible
140+
const PanelView = require("view/PanelView");
141+
PanelView.on(PanelView.EVENT_PANEL_SHOWN, function (_event, panelId) {
142+
if (panelId === PANEL_ID) {
143+
const active = _getActiveTerminal();
144+
if (active) {
145+
active.handleResize();
146+
active.focus();
147+
}
148+
}
149+
});
150+
139151
// Listen for theme changes via MutationObserver on body class
140152
const observer = new MutationObserver(function () {
141153
_updateAllThemes();
@@ -264,7 +276,6 @@ define(function (require, exports, module) {
264276
// Show panel if hidden
265277
if (!panel.isVisible()) {
266278
panel.show();
267-
268279
}
269280

270281
// Spawn PTY process

0 commit comments

Comments
 (0)