home/.config/yabai/open-iterm2.sh

18 lines
452 B
Bash
Executable File

#! /bin/sh
#
# open-iterm2.sh
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
#
# Distributed under terms of the MIT license.
#
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
echo "Killing iTerm and restarting"
killall "iTerm"
exec open -a "/Applications/iTerm.app"
fi