-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopen_terminals.sh
More file actions
executable file
·71 lines (64 loc) · 1.86 KB
/
open_terminals.sh
File metadata and controls
executable file
·71 lines (64 loc) · 1.86 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Opens iTerm2, Ghostty, and WezTerm each in a row on screen,
# cd to ~/dev/dirplot and runs: uv run dirplot --inline --log src
CMD='cd ~/dev/dirplot && uv run dirplot --inline --log src'
# Get usable screen bounds from Finder (excludes Dock)
BOUNDS=$(osascript -e '
tell application "Finder"
set b to bounds of window of desktop
set x1 to item 1 of b
set y1 to item 2 of b
set x2 to item 3 of b
set y2 to item 4 of b
return (x1 as string) & "," & (y1 as string) & "," & (x2 as string) & "," & (y2 as string)
end tell')
IFS=',' read -r SX SY SR SB <<< "$BOUNDS"
MENU_BAR=38
SY=$((SY + MENU_BAR))
SCREEN_W=$((SR - SX))
SCREEN_H=$((SB - SY))
COL_W=$((SCREEN_W / 3))
X0=$SX; R0=$((X0 + COL_W))
X1=$((SX+COL_W)); R1=$((X1 + COL_W))
X2=$((SX+COL_W*2)); R2=$((X2 + COL_W))
Y=$SY
BOT=$((Y + SCREEN_H))
# --- iTerm2 (left) ---
osascript <<EOF
tell application "iTerm2"
activate
set w to (create window with default profile)
tell current session of w
set columns to 80
set rows to 25
write text "$CMD"
end tell
set bounds of w to {$X0, $Y, $R0, $BOT}
end tell
EOF
# --- Ghostty (middle) ---
/Applications/Ghostty.app/Contents/MacOS/ghostty -e bash -ic "$CMD; exec bash" &
osascript <<EOF
tell application "System Events"
tell process "Ghostty"
repeat while (count of windows) is 0
delay 0.3
end repeat
set bounds of window 1 to {$X1, $Y, $R1, $BOT}
end tell
end tell
EOF
# --- WezTerm (right) ---
wezterm start -- bash -ic "$CMD; exec bash" &
osascript <<EOF
tell application "WezTerm" to activate
tell application "System Events"
tell process "wezterm-gui"
repeat while (count of windows) is 0
delay 0.3
end repeat
set position of window 1 to {$X2, $Y}
set size of window 1 to {$COL_W, $SCREEN_H}
end tell
end tell
EOF