Created
April 6, 2016 13:12
-
-
Save jimschubert/354f6455ba2671838a893fa1658ddf88 to your computer and use it in GitHub Desktop.
/Applications/Docker/Kitematic (Beta).app/Contents/Resources/resources/terminal for iTerm2 3.0 beta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
CMD="clear && $*" | |
ITERM_EXISTS=`osascript <<EOF | |
set doesExist to false | |
try | |
do shell script "osascript -e 'exists application \"iTerm2\"'" | |
set doesExist to true | |
end try | |
return doesExist | |
EOF` | |
function open_iterm () { | |
osascript > /dev/null <<EOF | |
tell application "iTerm2" | |
activate | |
set newWindow to (create window with default profile) | |
select first window | |
tell current window | |
tell current session | |
write text "bash -c \"$CMD\"" | |
end tell | |
end tell | |
end tell | |
EOF | |
} | |
function open_terminal () { | |
osascript > /dev/null <<EOF | |
tell application "Terminal" to activate | |
delay 0.4 | |
tell application "System Events" to keystroke "t" using command down | |
tell application "Terminal" | |
do script "bash -c \"$CMD\"" in window 1 | |
end tell | |
EOF | |
} | |
if [ "$ITERM_EXISTS" == "true" ]; then | |
open_iterm "$@" # || open_terminal "$@" | |
else | |
open_terminal "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment