mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Create new window for terminal session open
This commit is contained in:
parent
33ae876edb
commit
12151c2c43
1 changed files with 10 additions and 2 deletions
|
|
@ -108,7 +108,11 @@ enum Terminal: String, CaseIterable {
|
||||||
return .appleScript(script: """
|
return .appleScript(script: """
|
||||||
tell application "Terminal"
|
tell application "Terminal"
|
||||||
activate
|
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
|
end tell
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
@ -328,11 +332,15 @@ final class TerminalLauncher {
|
||||||
// Give the terminal time to start
|
// Give the terminal time to start
|
||||||
Thread.sleep(forTimeInterval: delay)
|
Thread.sleep(forTimeInterval: delay)
|
||||||
|
|
||||||
// Type the command
|
// Type the command with new window creation
|
||||||
let typeScript = """
|
let typeScript = """
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "\(config.terminal.processName)"
|
tell process "\(config.terminal.processName)"
|
||||||
set frontmost to true
|
set frontmost to true
|
||||||
|
-- Create new window with Cmd+N
|
||||||
|
keystroke "n" using {command down}
|
||||||
|
delay 0.2
|
||||||
|
-- Type the command
|
||||||
keystroke "\(config.fullCommand)"
|
keystroke "\(config.fullCommand)"
|
||||||
key code 36
|
key code 36
|
||||||
end tell
|
end tell
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue