From 12151c2c43fcaa072b7470288f6e2c271feb9c96 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 17 Jun 2025 12:45:27 +0200 Subject: [PATCH] Create new window for terminal session open --- VibeTunnel/Utilities/TerminalLauncher.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/VibeTunnel/Utilities/TerminalLauncher.swift b/VibeTunnel/Utilities/TerminalLauncher.swift index 0c6111c0..f5c1aad0 100644 --- a/VibeTunnel/Utilities/TerminalLauncher.swift +++ b/VibeTunnel/Utilities/TerminalLauncher.swift @@ -108,7 +108,11 @@ enum Terminal: String, CaseIterable { return .appleScript(script: """ tell application "Terminal" activate - do script "\(config.fullCommand)" + tell application "System Events" + keystroke "n" using {command down} + end tell + delay 0.1 + do script "\(config.fullCommand)" in front window end tell """) @@ -328,11 +332,15 @@ final class TerminalLauncher { // Give the terminal time to start Thread.sleep(forTimeInterval: delay) - // Type the command + // Type the command with new window creation let typeScript = """ tell application "System Events" tell process "\(config.terminal.processName)" set frontmost to true + -- Create new window with Cmd+N + keystroke "n" using {command down} + delay 0.2 + -- Type the command keystroke "\(config.fullCommand)" key code 36 end tell