Yabai: Change iTerm script to reflect its behavior

With my config, it doesn't spawn a window on first launch
This commit is contained in:
Salt 2020-04-08 01:23:10 -05:00
parent 77077edd46
commit 69d99c998b

View File

@ -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