Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.