From 69d99c998b318cbaa4b3c964dd26ed1809001bc0 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 8 Apr 2020 01:23:10 -0500 Subject: [PATCH] Yabai: Change iTerm script to reflect its behavior With my config, it doesn't spawn a window on first launch --- .config/yabai/open-iterm2.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.config/yabai/open-iterm2.sh b/.config/yabai/open-iterm2.sh index 0ea1e260..3a6825e6 100755 --- a/.config/yabai/open-iterm2.sh +++ b/.config/yabai/open-iterm2.sh @@ -6,12 +6,17 @@ # Distributed under terms of the MIT license. # +osascriptcmd='tell application "iTerm2" to create window with default profile' if ! pgrep -f "iTerm" > /dev/null 2>&1; then echo "Opening iTerm" - exec open -a "/Applications/iTerm.app" -elif ! osascript -e 'tell application "iTerm2" to create window with default profile' > /dev/null 2>&1; then + open -a "/Applications/iTerm.app" +fi +if osascript -e "$osascriptcmd" > /dev/null 2>&1; then + echo "Opening new iTerm window" +else echo "Killing iTerm and restarting" killall "iTerm" - exec open -a "/Applications/iTerm.app" + open -a "/Applications/iTerm.app" + osascript -e "$osascriptcmd" fi