A Better Cygwin Console with RXVT
Cygwin 1.7 was just released a few weeks ago, so I thought it would be a good opportunity to share an old trick for making Cygwin's terminal window a little nicer by using RXVT and 'screen.'
RXVT is a console emulator; basically it replaces the 'cmd' executable that displays the native Windows terminal. You can also specify the font and use screen to get multi-terminal support. In order to get just RXVT working, here's a batch script to use instead of cygwin.bat:
@echo off C: chdir C:\cygwin\bin rem if NOT "x%DISPLAY%" == "x" set DISPLAY= rem if "x%FGCOLOR%" == "x" set FGCOLOR=White rem if "x%BGCOLOR%" == "x" set BGCOLOR=Black start rxvt -backspacekey ^H -sl 2500 -sr -tn rxvt -geometry 80x25 -font "Bitstream Vera Sans Mono-14" -e /bin/bash --login -i exit
Note that the character after the -backspacekey is actually the backspace character (^H or \u08). If you can't type that literal into your batch script, you'll probably have to copy and paste it from a character map (or get a better editor!)
If you want to use Screen (which I recommend) you can directly start it from RXVT to avoid an additional bash instance. You can also remove the scroll bar when you use screen, since scrolling is handled by keyboard commands similar to *NIX pagers like the less command. If you're not familiar with screen, here's a tutorial and reference. Here's the command to invoke cygwin using RXVT and screen:
start rxvt -backspacekey ^H -sl 2500 +sb -tn rxvt -geometry 100x55 -font "Lucida Console-12" -e /usr/bin/screen -a
In this case, Screen determines which shell to start up when invoked. Finally, a screenshot of the result:
One more trick - RXVT's default icon is pretty bland, and I'd much rather use the Cygwin icon. How to do that? Enter XNResourceEditor. You can modify the Windows icon for any executable, and also extract icons that are already embedded in .exe files. I imported the Cygwin.ico file that comes with their distribution into rxvt.exe -- but remember every time you upgrade Cygwin you'll have to repeat this process.
Not so keen on Screen?
As an alternative to RXVT and screen, you can also use Console2, which is a little more user-friendly, with configuration dialogs and visual tabs for multiple environments. Console2 is also handy for directly running interactive language interpreters such as Python and irb. I actually went overboard to see how useful multiple shells can be -- and the answer is it can be pretty handy:All tabs even have their own icon! Note that not all of these packages came with a .ico file, I had to extract the icons using XNResourceEditor for Python and PowerShell, and I downloaded the Ruby icon.
(Comments are closed)
3 Comments
BTW - here's my '.screenrc' file:
Re: A Better Cygwin Console with RXVT Nov. 5, 2010 David
Have you tried using 'screen' under Console2? I'm use screen heavily and have been using it with rxvt and Xming but that setup seems like a huge memory hog. I wanted to try using Console2 and screen but 1) the hardstatus bar under screen messes up the display on Console2 as it tries to scroll everytime there's an update. And 2) I can't reattach a detached screen session, haven't found out why yet.
Well, my primary goal was simply multiple sessions, which both screen and Console2 achieve... So there's little reason for me to use both. I would assume rxvt would use less memory than Console2 since it's much simpler. If you're concerned about memory you could probably use screen in a plain 'cmd' window.