Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Toggle terminal colors for different servers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Toggle terminal colors for different servers
Authored by: davidswelt on Nov 19, '04 06:58:45AM

I use this to set the background color of terminal windows depending on the server that i'm logged on to in that window.

The previously posted code does this in AppleScript, but you'd need to have a way to trigger this depending on the server that's i'm SSH'ed into. I don't know how to do this, however, doing it via the shell automatically works just fine. Of course, we need to reset the color once the SSH session has ended, and for that, we need to remember the window ID that we're running in. Here's my SSH script that logs me into a server (via a proxy login server) that I've just written (you may need to check the line breaks):


THEW=`osascript -e 'front window of app "Terminal"'`
osascript -e "tell application \"Terminal\" to set background color of $THEW to {65535,38807,13621}"

ssh -t -X 'ssh -X mymachine'

osascript -e "tell application \"Terminal\" to set background color of $THEW to {65535,59881,28013}"

Get the colors with DigitalColor Meter as previously posted (thanks for the tip) -- set it to "RGB as Actual Value 16 Bit"

--- // personal:

[ Reply to This | # ]