Skip to content

Instantly share code, notes, and snippets.

@evanmoran
Created March 20, 2012 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanmoran/2130081 to your computer and use it in GitHub Desktop.
Save evanmoran/2130081 to your computer and use it in GitHub Desktop.
Bash script to open new terminal windows / tabs by theme
function terminal_open {
osascript -e 'tell application "Terminal" to activate' \
-e 'tell application "System Events"' \
-e 'tell process "Terminal"' \
-e "tell menu item \"${1}\" of menu \"New ${2}\" of menu item \"New ${2}\" of menu \"Shell\" of menu bar item \"Shell\" of menu bar 1" \
-e 'click' \
-e 'end tell' \
-e 'end tell' \
-e 'end tell' > /dev/null
}
# Open new windows by terminal theme name
alias lw='echo "[light window]"; terminal_open "Solarized Light" "Window"'
alias dw='echo "[dark window]"; terminal_open "Solarized Dark" "Window"'
# Open new tabs by terminal theme name
alias lt='echo "[light tab]"; terminal_open "Solarized Light" "Tab"'
alias dt='echo "[dark tab]"; terminal_open "Solarized Dark" "Tab"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment