Created
April 19, 2011 04:36
-
-
Save michaelbartnett/926819 to your computer and use it in GitHub Desktop.
Start iTerm if not started, close first window that pops up
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.bartnett.itermonlogin</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> | |
<string>osascript</string> | |
<string>{/path_to_your_script_folder}/launch_iterm_nowindow.applescript</string> | |
</array> | |
</dict> | |
</plist> |
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
# Check if iTerm is running, if not then | |
# 1. Launch it | |
# 2. Close the first window that opens | |
# 3. Reactivate previous application | |
on appIsRunning(appName) | |
tell application "System Events" to (name of processes) contains appName | |
end appIsRunning | |
if not appIsRunning("iTerm") then | |
set current_app to (path to frontmost application as Unicode text) | |
if the (count of windows) is not 0 then | |
set current_window to name of front window | |
end if | |
tell application "iTerm" | |
activate | |
close current terminal | |
end tell | |
tell application current_app | |
activate | |
activate current_window | |
end tell | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment