summaryrefslogtreecommitdiff
path: root/.local/bin/macos.d/ghostty-split.sh
blob: 36023e63a7271e52d698d0c52aa9ec5f96d34c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash


osa='
on runCommandInteractively(theCommand)
	tell application "Ghostty" to activate

  tell application "System Events"
    tell process "Ghostty"
      keystroke return using command down
    end tell
  end tell
  delay 0.2

	tell application "System Events"
		keystroke ((" " & theCommand) as text)
		keystroke return
	end tell
end runCommandInteractively

on run args
if class of args is list then -- arguments passed come in as a list
		set quotedArgs to {}
		repeat with arg in args
			-- set end of quotedArgs to "'"'"'" & arg & "'"'"'"
			set end of quotedArgs to "" & arg
		end repeat

    set AppleScript'"'"'s text item delimiters to " "
		set joinedArgs to quotedArgs as string
    set AppleScript'"'"'s text item delimiters to ""

		runCommandInteractively(joinedArgs)
end if
end run
'
osascript -e "$osa" -- "$@"