diff --git a/.config/skhd/skhdrc b/.config/skhd/skhdrc index 797c92a5..356a809b 100644 --- a/.config/skhd/skhdrc +++ b/.config/skhd/skhdrc @@ -1,5 +1,5 @@ # Open Terminal -cmd - return : /Applications/iTerm.app/Contents/MacOS/iTerm2 +cmd - return : ~/.config/yabai/open-iterm2.sh # Navigation cmd - h : yabai -m window --focus west diff --git a/.config/yabai/open-iterm2.sh b/.config/yabai/open-iterm2.sh new file mode 100755 index 00000000..fcba0de3 --- /dev/null +++ b/.config/yabai/open-iterm2.sh @@ -0,0 +1,15 @@ +#! /bin/sh +# +# open-iterm2.sh +# Copyright (C) 2020 Vintage Salt +# +# Distributed under terms of the MIT license. +# + +if pgrep -f "iTerm" > /dev/null 2>&1; then + exec open -a "/Applications/iTerm.app" +elif ! osascript -e 'tell application "iTerm2" to create window with default profile' > /dev/null 2>&1; then + killall "iTerm" + exec open -a "/Applications/iTerm.app" +fi +