2020-04-06 06:51:49 -05:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# open-iterm2.sh
|
|
|
|
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
|
|
|
#
|
|
|
|
# Distributed under terms of the MIT license.
|
|
|
|
#
|
|
|
|
|
2020-04-08 01:23:10 -05:00
|
|
|
osascriptcmd='tell application "iTerm2" to create window with default profile'
|
2020-04-06 06:54:55 -05:00
|
|
|
if ! pgrep -f "iTerm" > /dev/null 2>&1; then
|
|
|
|
echo "Opening iTerm"
|
2020-04-08 01:23:10 -05:00
|
|
|
open -a "/Applications/iTerm.app"
|
|
|
|
fi
|
|
|
|
if osascript -e "$osascriptcmd" > /dev/null 2>&1; then
|
|
|
|
echo "Opening new iTerm window"
|
|
|
|
else
|
2020-04-06 06:54:55 -05:00
|
|
|
echo "Killing iTerm and restarting"
|
2020-04-06 06:51:49 -05:00
|
|
|
killall "iTerm"
|
2020-04-08 01:23:10 -05:00
|
|
|
open -a "/Applications/iTerm.app"
|
|
|
|
osascript -e "$osascriptcmd"
|
2020-04-06 06:51:49 -05:00
|
|
|
fi
|
|
|
|
|