From 8f3b739361e1b4e1cb8b0a0b574dbd9c05399bcf Mon Sep 17 00:00:00 2001 From: Towhid Date: Tue, 6 May 2025 14:37:39 +0330 Subject: [PATCH] update refines the terminal toggle functionality --- src/extension.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 3210818..8e170d0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -35,7 +35,13 @@ export function activate(context: vscode.ExtensionContext) { let disposable = vscode.commands.registerCommand( "terminal-in-status-bar.toggle", () => { - vscode.commands.executeCommand("workbench.action.terminal.focus"); + const isPanelVisible = vscode.window.state.focused && vscode.window.activeTerminal; + + if (isPanelVisible) { + vscode.commands.executeCommand("workbench.action.togglePanel"); + } else { + vscode.commands.executeCommand("workbench.action.terminal.toggleTerminal"); + } } );