2024-01-20 15:52:54 +00:00
|
|
|
# Maintainer: Dimitar Nizamov @dimitur2204
|
|
|
|
# Contact maintainer for any change to this file.
|
2024-01-19 19:37:36 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# for "true full screen" call the script with "fullscreen" as the first argument
|
|
|
|
TRUE_FULL_SCREEN="$1"
|
|
|
|
|
2024-01-20 15:52:54 +00:00
|
|
|
start_terminal_and_run_tmux() {
|
2024-01-19 19:37:36 +00:00
|
|
|
osascript <<-EOF
|
2024-01-19 20:27:33 +00:00
|
|
|
tell application "Warp"
|
2024-01-19 19:37:36 +00:00
|
|
|
activate
|
2024-01-20 15:57:15 +00:00
|
|
|
delay 1
|
2024-01-19 20:27:33 +00:00
|
|
|
tell application "System Events" to tell process "Warp"
|
|
|
|
set frontmost to true
|
2024-01-19 19:58:49 +00:00
|
|
|
keystroke "tmux"
|
2024-01-19 19:37:36 +00:00
|
|
|
key code 36
|
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
resize_window_to_full_screen() {
|
|
|
|
osascript <<-EOF
|
2024-01-19 20:27:33 +00:00
|
|
|
tell application "Warp"
|
2024-01-19 19:37:36 +00:00
|
|
|
activate
|
|
|
|
tell application "System Events"
|
2024-01-19 20:27:33 +00:00
|
|
|
if (every window of process "Warp") is {} then
|
2024-01-19 19:37:36 +00:00
|
|
|
keystroke "n" using command down
|
|
|
|
end if
|
|
|
|
|
|
|
|
tell application "Finder"
|
|
|
|
set desktopSize to bounds of window of desktop
|
|
|
|
end tell
|
|
|
|
|
2024-01-19 20:27:33 +00:00
|
|
|
set position of front window of process "Warp" to {0, 0}
|
|
|
|
set size of front window of process "Warp" to {item 3 of desktopSize, item 4 of desktopSize}
|
2024-01-19 19:37:36 +00:00
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
resize_to_true_full_screen() {
|
|
|
|
osascript <<-EOF
|
2024-01-19 20:27:33 +00:00
|
|
|
tell application "Warp"
|
2024-01-20 16:01:23 +00:00
|
|
|
# wait for Warp to start
|
2024-01-19 19:37:36 +00:00
|
|
|
delay 1
|
2024-01-20 16:01:23 +00:00
|
|
|
activate
|
|
|
|
# short wait for Warp to gain focus
|
|
|
|
delay 0.1
|
2024-01-19 20:27:33 +00:00
|
|
|
tell application "System Events" to tell process "Warp"
|
2024-01-19 19:37:36 +00:00
|
|
|
keystroke "f" using {control down, command down}
|
|
|
|
end tell
|
|
|
|
end tell
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2024-01-20 15:52:54 +00:00
|
|
|
start_terminal_and_run_tmux
|
2024-01-19 19:37:36 +00:00
|
|
|
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
|
|
|
|
resize_to_true_full_screen
|
|
|
|
else
|
|
|
|
resize_window_to_full_screen
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
main
|