shosei

Change terminal theme depending on where you're ssh-ing to

Mar 15th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. # https://gist.github.com/1297464/23c2f977a8cd010704cb242eac26d9b9880a036d
  2. # Author: tunaranch
  3. # Fix bug talked about at http://news.ycombinator.com/item?id=2418726
  4.  
  5. # Tested on zsh. Paste the two following functions in your .zshrc.
  6. # Customise the case switch to suit your own colour/host combos
  7.  
  8.  
  9. function tabc {
  10.         osascript -e "tell application \"Terminal\" to set current settings of $1 to settings set \"$2\""
  11. }
  12.  
  13. function ssh {
  14.   local tabid;
  15.   tabid=$(osascript -e "tell application \"Terminal\" to get selected tab of front window")
  16.   case $1 in
  17.     *foo01*)
  18.         tabc $tabid "Ocean";;
  19.     *foo02*)
  20.         tabc $tabid "Grass";;
  21.     *)
  22.         tabc $tabid "Pro";;
  23.   esac
  24.  
  25.   /usr/bin/ssh "$@"
  26.   tabc $tabid "Novel"
  27. }
Advertisement
Add Comment
Please, Sign In to add comment