From eab1fd9b55a19548ba70c7cc54d743e7057c1622 Mon Sep 17 00:00:00 2001 From: hsayed21 Date: Wed, 13 Nov 2024 20:45:34 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A8=20update:=20restore=20terminal?= =?UTF-8?q?=20panel=20size=20when=20hide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 186ab05..e81305f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -21,6 +21,7 @@ let PACKAGE: any; let term: vscode.Terminal; let previousActiveTerminal: vscode.Terminal | null; let isExtensionChangedTerminal = false; +let isTerminalMaximized = false; // // Define the commands we expose. URIs are populated upon extension activation @@ -640,9 +641,15 @@ function handleCanaryFileChange() { } if (commandWasSuccess && CFG.hideTerminalAfterSuccess) { + if (CFG.showMaximizedTerminal && isTerminalMaximized) + vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); term.hide(); + isTerminalMaximized = false; } else if (!commandWasSuccess && CFG.hideTerminalAfterFail) { + if (CFG.showMaximizedTerminal && isTerminalMaximized) + vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); term.hide(); + isTerminalMaximized = false; } else { // Don't hide the terminal and make clippy angry } @@ -811,7 +818,10 @@ async function executeTerminalCommand(cmd: string) { if (cbResult === true) { term.sendText(getCommandString(commands[cmd])); if (CFG.showMaximizedTerminal) { - vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); + await vscode.commands.executeCommand('workbench.action.closeSidebar'); + await vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); + await vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); + isTerminalMaximized = true; } if (CFG.restoreFocusTerminal) { previousActiveTerminal = vscode.window.activeTerminal ?? null; From 48915dcb51ffce9694155b382adfbaff8b58a570 Mon Sep 17 00:00:00 2001 From: hsayed21 Date: Thu, 14 Nov 2024 09:46:51 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A8=20update:=20also=20handle=20te?= =?UTF-8?q?rminal=20size=20when=20killTerminalAfterUse=20and=20restoreFocu?= =?UTF-8?q?sTerminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extension.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index e81305f..f52d2d9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -621,6 +621,9 @@ function handleCanaryFileChange() { // We set a timeout here to address #56. Don't have a good hypothesis as to why this works but // it seems to fix the issue consistently. setTimeout(() => term.dispose(), 100); + if (CFG.showMaximizedTerminal && isTerminalMaximized) + vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); + isTerminalMaximized = false; } fs.readFile(CFG.canaryFile, { encoding: 'utf-8' }, (err, data) => { @@ -666,6 +669,9 @@ function handleTerminalFocusRestore(commandWasSuccess: boolean) { previousActiveTerminal?.hide(); previousActiveTerminal = null; isExtensionChangedTerminal = false; + if (CFG.showMaximizedTerminal && isTerminalMaximized) + vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel'); + isTerminalMaximized = false; disposable.dispose(); } });