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 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..45ff5c2 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" @@ -40,8 +40,11 @@ resize_window_to_full_screen() { resize_to_true_full_screen() { osascript <<-EOF tell application "Alacritty" + # wait for alacritty to start + delay 1 activate - delay 0.5 + # short wait for alacritty to gain focus + delay 0.1 tell application "System Events" to tell process "Alacritty" if front window exists then tell front window diff --git a/scripts/handle_tmux_automatic_start/osx_enable.sh b/scripts/handle_tmux_automatic_start/osx_enable.sh index a7fea78..5a11253 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" 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..5512beb 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" @@ -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 new file mode 100755 index 0000000..9b98dd5 --- /dev/null +++ b/scripts/handle_tmux_automatic_start/osx_warp_start_tmux.sh @@ -0,0 +1,65 @@ +# 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_terminal_and_run_tmux() { + osascript <<-EOF + tell application "Warp" + activate + delay 1 + tell application "System Events" to tell process "Warp" + set frontmost to true + keystroke "tmux" + 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" + # 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 + end tell + EOF +} + +main() { + start_terminal_and_run_tmux + if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then + resize_to_true_full_screen + else + resize_window_to_full_screen + fi +} +main