From 89adeec3e9da38419139f82feebcb8329c34b913 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Fri, 19 Jan 2024 20:37:36 +0100 Subject: [PATCH 01/12] add auto start script for warp terminal --- .../osx_warp_start_tmux.sh | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh new file mode 100755 index 0000000..876042c --- /dev/null +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# for "true full screen" call the script with "fullscreen" as the first argument +TRUE_FULL_SCREEN="$1" + +start_warp_and_run_tmux() { + osascript <<-EOF + tell application "warp" + activate + delay 1 + tell application "System Events" to tell process "warp" + keystroke "tmux attach" + key code 36 + end tell + end tell + EOF +} + +resize_window_to_full_screen() { + osascript <<-EOF + tell application "warp" + activate + tell application "System Events" + if (every window of process "warp") is {} then + keystroke "n" using command down + end if + + tell application "Finder" + set desktopSize to bounds of window of desktop + end tell + + 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} + end tell + end tell + EOF +} + +resize_to_true_full_screen() { + osascript <<-EOF + tell application "warp" + activate + delay 1 + tell application "System Events" to tell process "warp" + keystroke "f" using {control down, command down} + end tell + end tell + EOF +} + +main() { + start_warp_and_run_tmux + if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then + resize_to_true_full_screen + else + resize_window_to_full_screen + fi +} +main From 7ab48fdf80110f97ccf3b1e5f753cc879383e443 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Fri, 19 Jan 2024 20:42:33 +0100 Subject: [PATCH 02/12] add warp to strategy script --- scripts/handle_tmux_automatic_start/osx_enable.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/handle_tmux_automatic_start/osx_enable.sh b/scripts/handle_tmux_automatic_start/osx_enable.sh index 38e6537..fdd41b4 100755 --- a/scripts/handle_tmux_automatic_start/osx_enable.sh +++ b/scripts/handle_tmux_automatic_start/osx_enable.sh @@ -43,6 +43,8 @@ get_strategy() { echo "kitty" elif [[ "$options" =~ "alacritty" ]]; then echo "alacritty" + elif [[ "$options" =~ "warp" ]]; then + echo "warp" else # Terminal.app is the default console app echo "terminal" From 6198b5a7942154e1b292c82bcc83b66afe9053cc Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Fri, 19 Jan 2024 20:42:45 +0100 Subject: [PATCH 03/12] add warp to startup docs --- docs/automatic_start.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/automatic_start.md b/docs/automatic_start.md index 2b7e443..eda9d2f 100644 --- a/docs/automatic_start.md +++ b/docs/automatic_start.md @@ -27,6 +27,9 @@ Config options: - `set -g @continuum-boot-options 'alacritty'` - start [alacritty](https://github.com/alacritty/alacritty) instead of `Terminal.app` - `set -g @continuum-boot-options 'alacritty,fullscreen'` - start `alacritty` in fullscreen +- `set -g @continuum-boot-options 'warp'` - start [warp](https://github.com/warpdotdev/Warp) instead of `Terminal.app` +- `set -g @continuum-boot-options 'warp,fullscreen'` - start `warp` + in fullscreen Note: The first time you reboot your machine and activate this feature you may be prompted about a script requiring access to a system program (i.e. - System Events). If this happens tmux will not start automatically and you will need From 9c1f1ce839ab6a879510f61c347c86361ca70680 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Fri, 19 Jan 2024 20:58:49 +0100 Subject: [PATCH 04/12] change initial command to "tmux", not "tmux a" --- scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh index 876042c..258e52c 100755 --- a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -9,7 +9,7 @@ start_warp_and_run_tmux() { activate delay 1 tell application "System Events" to tell process "warp" - keystroke "tmux attach" + keystroke "tmux" key code 36 end tell end tell From 40d6ad94af70a3a6abc65e3c3f5f41e886632f9e Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Fri, 19 Jan 2024 21:27:33 +0100 Subject: [PATCH 05/12] fix warp process casing --- .../osx_warp_start_tmux.sh | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh index 258e52c..1c155cf 100755 --- a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -3,12 +3,13 @@ # for "true full screen" call the script with "fullscreen" as the first argument TRUE_FULL_SCREEN="$1" -start_warp_and_run_tmux() { +start_Warp_and_run_tmux() { osascript <<-EOF - tell application "warp" + tell application "Warp" activate - delay 1 - tell application "System Events" to tell process "warp" + delay 2 + tell application "System Events" to tell process "Warp" + set frontmost to true keystroke "tmux" key code 36 end tell @@ -18,10 +19,10 @@ start_warp_and_run_tmux() { resize_window_to_full_screen() { osascript <<-EOF - tell application "warp" + tell application "Warp" activate tell application "System Events" - if (every window of process "warp") is {} then + if (every window of process "Warp") is {} then keystroke "n" using command down end if @@ -29,8 +30,8 @@ resize_window_to_full_screen() { set desktopSize to bounds of window of desktop end tell - 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} + 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} end tell end tell EOF @@ -38,10 +39,10 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF - tell application "warp" + tell application "Warp" activate delay 1 - tell application "System Events" to tell process "warp" + tell application "System Events" to tell process "Warp" keystroke "f" using {control down, command down} end tell end tell @@ -49,7 +50,7 @@ resize_to_true_full_screen() { } main() { - start_warp_and_run_tmux + start_Warp_and_run_tmux if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then resize_to_true_full_screen else From d22f69429deb2a36686e84a79b29c272115ddb84 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 16:52:54 +0100 Subject: [PATCH 06/12] add name and github handle as maintainer, refactor --- .../handle_tmux_automatic_start/osx_warp_start_tmux.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh index 1c155cf..44705df 100755 --- a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -1,13 +1,15 @@ +# Maintainer: Dimitar Nizamov @dimitur2204 +# Contact maintainer for any change to this file. #!/usr/bin/env bash # for "true full screen" call the script with "fullscreen" as the first argument TRUE_FULL_SCREEN="$1" -start_Warp_and_run_tmux() { +start_terminal_and_run_tmux() { osascript <<-EOF tell application "Warp" activate - delay 2 + delay 5 tell application "System Events" to tell process "Warp" set frontmost to true keystroke "tmux" @@ -50,7 +52,7 @@ resize_to_true_full_screen() { } main() { - start_Warp_and_run_tmux + start_terminal_and_run_tmux if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then resize_to_true_full_screen else From cf8baeade0f71241391256bba526c9dbb900957f Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 16:57:15 +0100 Subject: [PATCH 07/12] refactor kitty,alacritty,warp startup scripts to same implementation --- .../osx_alacritty_start_tmux.sh | 18 +++++------------- .../osx_kitty_start_tmux.sh | 2 +- .../osx_warp_start_tmux.sh | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index e9f09c6..8842cf0 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -7,7 +7,7 @@ start_terminal_and_run_tmux() { osascript <<-EOF tell application "alacritty" activate - delay 0.5 + delay 1 tell application "System Events" to tell process "alacritty" set frontmost to true keystroke "tmux" @@ -39,19 +39,11 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF - tell application "Alacritty" + tell application "alacritty" activate - delay 0.5 - tell application "System Events" to tell process "Alacritty" - if front window exists then - tell front window - if value of attribute "AXFullScreen" then - set value of attribute "AXFullScreen" to false - else - set value of attribute "AXFullScreen" to true - end if - end tell - end if + delay 1 + tell application "System Events" to tell process "alacritty" + keystroke "f" using {control down, command down} end tell end tell EOF diff --git a/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh index 94c1d2b..4a08626 100755 --- a/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh @@ -7,7 +7,7 @@ start_terminal_and_run_tmux() { osascript <<-EOF tell application "kitty" activate - delay 5 + delay 1 tell application "System Events" to tell process "kitty" set frontmost to true keystroke "tmux" diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh index 44705df..940d630 100755 --- a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -9,7 +9,7 @@ start_terminal_and_run_tmux() { osascript <<-EOF tell application "Warp" activate - delay 5 + delay 1 tell application "System Events" to tell process "Warp" set frontmost to true keystroke "tmux" From b767f06c9b794096582ed26622cc35f11231a5ca Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 17:01:23 +0100 Subject: [PATCH 08/12] refactor fullscreen delays --- .../handle_tmux_automatic_start/osx_alacritty_start_tmux.sh | 5 ++++- scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh | 5 ++++- scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index 8842cf0..319e268 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -40,8 +40,11 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF tell application "alacritty" - activate + # wait for alacritty to start delay 1 + activate + # short wait for alacritty to gain focus + delay 0.1 tell application "System Events" to tell process "alacritty" keystroke "f" using {control down, command down} end tell diff --git a/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh index 4a08626..5512beb 100755 --- a/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_kitty_start_tmux.sh @@ -40,8 +40,11 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF tell application "kitty" - activate + # wait for kitty to start delay 1 + activate + # short wait for kitty to gain focus + delay 0.1 tell application "System Events" to tell process "kitty" keystroke "f" using {control down, command down} end tell diff --git a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh index 940d630..9b98dd5 100755 --- a/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -42,8 +42,11 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF tell application "Warp" - activate + # wait for Warp to start delay 1 + activate + # short wait for Warp to gain focus + delay 0.1 tell application "System Events" to tell process "Warp" keystroke "f" using {control down, command down} end tell From d6124a69ce741c3dedd943eaa5a6ee31fc6beb6f Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 17:05:17 +0100 Subject: [PATCH 09/12] return alacritty fullscreen with changed delays --- .../osx_alacritty_start_tmux.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index 319e268..b64e27e 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -39,16 +39,23 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF - tell application "alacritty" + tell application "Alacritty" # wait for alacritty to start delay 1 activate # short wait for alacritty to gain focus delay 0.1 - tell application "System Events" to tell process "alacritty" - keystroke "f" using {control down, command down} - end tell - end tell + tell application "System Events" to tell process "Alacritty" + if front window exists then + tell front window + if value of attribute "AXFullScreen" then + set value of attribute "AXFullScreen" to false + else + set value of attribute "AXFullScreen" to true + end if + end tell + end if + end tell EOF } From d8e654ada173101a71649bf3455362ce7710c800 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 17:06:24 +0100 Subject: [PATCH 10/12] return missed `end tell` --- scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index b64e27e..04617ab 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -56,6 +56,7 @@ resize_to_true_full_screen() { end tell end if end tell + end tell EOF } From b4e32f8a7586f4b77a1b1a1155dfa754d8165c70 Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 17:09:22 +0100 Subject: [PATCH 11/12] fix alacritty script formatting --- .../handle_tmux_automatic_start/osx_alacritty_start_tmux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index 04617ab..5b69d41 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -54,9 +54,9 @@ resize_to_true_full_screen() { set value of attribute "AXFullScreen" to true end if end tell - end if - end tell - end tell + end if + end tell + end tell EOF } From dcc41c4a44ca5ced4f9cd3983ca3174f1e56329f Mon Sep 17 00:00:00 2001 From: Dimitar Nizamov Date: Sat, 20 Jan 2024 17:10:07 +0100 Subject: [PATCH 12/12] change out tabs for spaces --- .../handle_tmux_automatic_start/osx_alacritty_start_tmux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh index 5b69d41..45ff5c2 100755 --- a/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh +++ b/scripts/handle_tmux_automatic_start/osx_alacritty_start_tmux.sh @@ -55,8 +55,8 @@ resize_to_true_full_screen() { end if end tell end if - end tell - end tell + end tell + end tell EOF }