From 3283aa48898930001a5798ad3cc2f40e80a28dcc Mon Sep 17 00:00:00 2001 From: Salt Date: Mon, 6 Apr 2020 06:51:49 -0500 Subject: [PATCH] skhd: Switch to an iTerm2 script It now tries to tell an existing iT2 process to open a window instead --- .config/skhd/skhdrc | 2 +- .config/yabai/open-iterm2.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 .config/yabai/open-iterm2.sh 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 +