While making myself at home on my new laptop I thought I'd try to tackle an Cygwin annoyance I regularly run into. My general practice is to have one rxvt window open that represents my local machine, and then one open for each remote system I'm ssh'd into. Within each rxvt instance I'm running screen. Even with screen I find that I can often lose track of which window is connected to which host and I have to Alt-tab through a whole mess of them before I can find the right window.
The solution I'm playing with: why not vary the rxvt background color so that I can quickly determine which window belongs to which host? I don't want to go through the trouble of predefining the colors and hosts, so instead I'm taking the lazy way out and picking a background color at random. A quick Google search shows this is not an original= idea.
Here's the script I came up with:
#!/bin/bash ## ## Spawn an rxvt instance with a random background color ## BGS='snow ghost GhostWhite WhiteSmoke Gainsboro floral OldLace Linen Mint MistyRose LightGray Sky LightSteelBlue PaleGreen Khaki LightYellow Beige Plum Thistle Seashell1 Bisque2 PeachPuff Azure1 SteelBlue1 LightCyan1 Grey68' count=`echo $BGS | tr ' ' '\n' | wc -l` index=`expr $RANDOM % $count` color=`echo $BGS | tr ' ' '\n' | head -$index | tail -1` rxvt -background $color "$@"
You can tweak the colors selected by choosing from any of the standard color names. In the cold precise world of computers, I do love that someone took the time to name each shade of color with such care.
No comments:
Post a Comment