Last active
October 11, 2018 01:34
-
-
Save henrytseng/f58ec119d5d989a6306d769d212b7648 to your computer and use it in GitHub Desktop.
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
# Color the OSX Terminal app according the hostname used in ssh | |
# Assumes you log in with a simple "ssh myuserid@remotehost" | |
# Read the following posts, which gave me the inspiration/knowledge: | |
# http://toolsmiths.blogspot.com/2010/04/how-to-change-your-osx-terminal-color.html | |
# http://www.ict4g.net/adolfo/notes/2014/07/16/change-osx-terminal-settings-from-command-line.html | |
# Two themes I am going to be toggling back and forth | |
LOCAL="Homebrew" | |
REMOTE="Ocean" | |
# Change the color of the terminal to the remote configuration | |
LS="Application(\"Terminal\").windows[0].currentSettings = Application(\"Terminal\").settingsSets[\"$REMOTE\"]" | |
osascript -l JavaScript -e "$LS" > /dev/null | |
# Do the normal ssh passing all original parameters to `ssh` | |
/usr/bin/ssh "$@" | |
# Change the color of the terminal back to what it was before | |
RS="Application(\"Terminal\").windows[0].currentSettings = Application(\"Terminal\").settingsSets[\"$LOCAL\"]" | |
osascript -l JavaScript -e "$RS" > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment