Created
January 29, 2014 21:29
-
-
Save agoodkind/8697604 to your computer and use it in GitHub Desktop.
Apple Script for Fish if it is Already installed to your /usr/local/bin directory and you don't want to chsh -s, derived from the original Fish.app script
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
tell application "System Events" | |
-- Don't create multiple windows if Terminal is not running | |
-- For some reason this sometimes throws an error on SnowLeopard | |
try | |
set terminal_count to count (processes whose bundle identifier is "com.apple.Terminal") | |
on error | |
set terminal_count to 1 | |
end try | |
if terminal_count is 0 then | |
tell application "Terminal" | |
activate | |
try | |
do script ("exec '/usr/local/bin/fish'") in window 0 | |
on error | |
-- If there's no window 0, just have it do it | |
do script ("exec '/usr/local/bin/fish'") | |
end try | |
end tell | |
else | |
-- Terminal was already running, open a new window | |
tell application "Terminal" | |
do script ("exec '/usr/local/bin/fish'") | |
activate | |
end tell | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment