SaltyCrane: ratpoisonhttps://www.saltycrane.com/blog/2007-10-19T09:14:00-07:00command-line inspiration
2007-10-19T09:14:00-07:00https://www.saltycrane.com/blog/2007/10/command-line-inspiration/
<div><font face="Arial" color="#000080" size="2"><a href="http://img.phraktured.net/screenshots/screenshot-20070305122500.png">http://img.phraktured.net/screenshots/screenshot-20070305122500.png</a></font></div>
Cygwin, X, ratposoin, screen, rxvt setup
2007-09-04T17:48:00-07:00https://www.saltycrane.com/blog/2007/09/cygwin-x-ratposoin-screen-rxvt-setup/Here are my configuration files for my current <a href="http://www.cygwin.com/">Cygwin</a>, <a href="http://en.wikipedia.org/wiki/X_Window_System">X</a>, <a href="http://www.nongnu.org/ratpoison/">ratpoison</a>, <a href="http://www.gnu.org/software/screen/">screen</a>, <a href="http://software.schmorp.de/pkg/rxvt-unicode.html">urxvt</a>, <a href="http://www.gnu.org/software/bash/">bash</a> setup.<br />
<br />
<b>General Cygwin and bash</b><br />
<ul><li>I changed filename completion to be case-insensitive since we're on Windows. To do this, see the last line in ~/.bashrc and the last line in ~/.inputrc below.</li>
<li>I changed the "/cygdrive" prefix to just "/". To do this, type this command once: "mount -s --change-cygdrive-prefix /"</li>
<li>I added aliases to use "grep" and "ls" with color. And I added aliases to start various windows applications. See ~/.bashrc.</li>
</ul>
<br /><b>urxvt</b><br />
<ul><li>urxvt (rxvt-unicode) is a better alternative to rxvt and xterm. See the ~.Xdefaults file for my urxvt customizations. I chose an anti-aliased font, removed the scrollbar, changed the background to dark blue and the foreground to light yellow, and set the number of saved lines to 8000. (Note, to scroll, hit SHIFT+PGUP or SHIFT+PGDN).</li>
</ul>
<br /><b>ratpoison and screen</b><br />
<ul><li>GNU Screen is a terminal multiplexer which can be used to manage terminal sessions. Ratpoison is a simple keyboard driven window manager largely modeled after GNU Screen which is used as an alternative to complex window managers such as <a href="http://en.wikipedia.org/wiki/GNOME">Gnome</a> or <a href="http://en.wikipedia.org/wiki/KDE">KDE</a>. Most of the ratpoison and screen configuration is copied from <a href="http://diveintomark.org/archives/2007/03/15/good-easy-2007">Mark Pilgrim</a>. The layering, as I understand it, is: the <strong>Windows XP</strong> OS runs the <strong>Cygwin/X</strong> environment which runs the <strong>ratpoison</strong> window manager which runs the <strong>urxvt</strong> terminal emulator which runs the <strong>screen</strong> terminal multiplexer which runs the <strong>bash</strong> command shell.</li></ul>
<br />
Update 5/2/2008: I learned how to paste in urxvt (actually bash). See my post,
<a href="http://www.saltycrane.com/blog/2008/05/how-to-paste-in-cygwin-bash-using-ctrl/">
How to paste in Cygwin bash using CTRL+V</a>.<br /><br />
<b>startxwin.bat</b> (windows batch file)<br />
<pre>@echo off
SET DISPLAY=127.0.0.1:0.0
SET CYGWIN_ROOT=\cygwin
SET RUN=%CYGWIN_ROOT%\bin\run -p /usr/X11R6/bin
SET PATH=.;%CYGWIN_ROOT%\bin;%CYGWIN_ROOT%\usr\X11R6\bin;%PATH%
SET XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults
SET XCMSDB=/usr/X11R6/lib/X11/Xcms.txt
SET XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
SET XNLSPATH=/usr/X11R6/lib/X11/locale
if not exist %CYGWIN_ROOT%\tmp\.X11-unix\X0 goto CLEANUP-FINISH
attrib -s %CYGWIN_ROOT%\tmp\.X11-unix\X0
del %CYGWIN_ROOT%\tmp\.X11-unix\X0
:CLEANUP-FINISH
if exist %CYGWIN_ROOT%\tmp\.X11-unix rmdir %CYGWIN_ROOT%\tmp\.X11-unix
if "%OS%" == "Windows_NT" goto OS_NT
echo startxwin.bat - Starting on Windows 95/98/Me
goto STARTUP
:OS_NT
echo startxwin.bat - Starting on Windows NT/2000/XP/2003
:STARTUP
%RUN% XWin -rootless -clipboard -silent-dup-error
%RUN% /usr/local/bin/ratpoison</pre>
<b>~/.ratpoisonrc</b><br />
<pre># initial frame and window setup
hsplit
focusright
exec urxvt -e screen -RD
# use Pause as prefix key instead of Ctrl-T
escape Pause
# use global cursor positioning (not per-frame)
warp off
# set appearance of ratpoison status messages and input line
set bgcolor black
set fgcolor grey95
set font -b&h-lucidatypewriter-bold-r-normal-sans-18-180-75-75-m-110-iso8859-1;
set inputwidth 1247
set bargravity ne
set barpadding 4 4
msgwait 3
# top-level shortcuts (don't require prefix key)
definekey top C-M-Up focusup
definekey top C-M-Down focusdown
definekey top C-M-Left focusleft
definekey top C-M-Right focusright</pre>
<b>~/.Xdefaults</b><br />
<pre>URxvt*background: #000033
URxvt*foreground: #ffffcc
! run "fc-list" for a list of available fonts
URxvt*font: xft:Bitstream Vera Sans Mono:size=12
Urxvt*boldFont: xft:Bitstream Vera Sans Mono:size=12:style=Bold
URxvt*scrollBar: False
URxvt*scrollTtyOutput: False
URxvt*scrollTtyKeypress: True
URxvt*secondaryScroll: True
URxvt*saveLines: 8000</pre>
<b>~/.screenrc</b><br />
<pre>shell /usr/bin/bash
# scrollback
defscrollback 8000
# Window numbering starts at 1
bind c screen 1
bind 0 select 10
screen 1
# Create initial windows
screen -t home 1
screen -t myproj 1
screen -t pydev 1
screen -t docs 1
screen -t misc 1
# Set the caption on the bottom line:
# window-list <nowplaying> <mm>dd</mm>yy> <hh:mm>am/pm
# from http://diveintomark.org/public/2007/03/screenrc
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= %1` %m/%d/%y %C:%s%a"
# use backtick for prefix key instead of Ctrl-A
escape ``
# use regular audible bell
vbell off
# skip intro
startup_message off
# detach on disconnect
autodetach on</hh:mm></nowplaying></pre>
<b>~/.bashrc</b><br />
<pre># prompt
# see http://www.ibm.com/developerworks/linux/library/l-tip-prompt/
export PS1="\n\e[31;1m\w\n\e[0m\$ "
# cygwin aliases
alias where='type -a'
alias grep='grep --color'
alias ls='ls --color=auto'
alias la='ls -dlAog --time-style="+%Y %m/%d %H:%M" .*; ls -Xlog --time-style="+%Y %m/%d %H:%M"'
alias ll='ls -Xlog --hide "*~" --hide "*.bak" --hide "*.orig" --time-style="+%Y %m/%d %H:%M"'
alias dir='ll'
alias ec='emacsclient -n '
# directory aliases
alias home='cd ~'
alias progfiles='cd /c/Program\ Files'
alias incoming='cd ~/incoming'
# windows aliases
alias firefox='/c/Program\ Files/Mozilla\ Firefox/firefox.exe &'
alias eclipse='/c/Programs/eclipse3.3/eclipse.exe -vmargs -Xms192m -Xmx192m &'
alias serena='/c/Program\ Files/Serena/vm/win32/bin/pvcsvmnt.exe &'
alias kdiff='/c/Program\ Files/KDiff3/kdiff3'
alias explorer='/c/windows/explorer /e /root,'
alias outlook='/c/Program\ Files/Microsoft\ Office/OFFICE11/OUTLOOK.EXE &'
alias taskmgr='/c/windows/system32/taskmgr.exe &'
alias word='/c/Program\ Files/Microsoft\ Office/OFFICE11/WINWORD.EXE '
alias excel='/c/Program\ Files/Microsoft\ Office/OFFICE11/EXCEL.EXE '
alias powerpoint='/c/Program\ Files/Microsoft\ Office/OFFICE11/POWERPNT.EXE '
alias acrobat='/c/Program\ Files/Adobe/Acrobat/Acrobat.exe '
# Get bash filename completion to be case insensitive - there is also a line in .inputrc
shopt -s nocaseglob</pre>
<b>~/.inputrc</b><br />
<pre># the following line is actually
# equivalent to "\C-?": delete-char
"\e[3~": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H": beginning-of-line
"\e[F": end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~": beginning-of-line
"\e[8~": end-of-line
# VT220
"\eOH": beginning-of-line
"\eOF": end-of-line
# Get bash filename completion to be case insensitive - see also .bashrc
set completion-ignore-case on</pre>
How to install ratpoison with Cygwin
2007-07-16T17:48:00-07:00https://www.saltycrane.com/blog/2007/07/ratpoison-with-cygwin-works/
<p>Running the minimalist ratpoison window manager with Cygwin/X works. You will need to install the following Cygwin packages:
<pre>gcc-core
make
readline
xorg-x11-base
xorg-x11-devel
</pre></p>
Here is how to install:<br />
<ol>
<li>Download <a href="http://www.nongnu.org/ratpoison/">ratpoison</a></li>
<li><pre>$ tar xvfz ratpoison-1.4.2.tar.gz
$ cd ratpoison-1.4.2
$ ./configure
$ make
$ make install</pre></li>
<li>Put the following lines in your startxwin.bat file (and remove the other old %RUN% commands):
<pre>%RUN% XWin -rootless -clipboard -silent-dup-error
%RUN% /usr/local/bin/ratpoison</pre></li>
<li>Run the startxwin.bat file</li>
</ol>
<br />
UPDATE 11/08/2007:<br />
<p>When I installed this the first time, I had no problems. The second time I installed, after getting a new PC, I got the following error message when running <kbd>configure</kbd>:
<pre>configure: error: *** Can't find X11 headers and libs</pre>
I thought the reason was because I forgot to install the <code>xorg-x11-devel</code> package which contains the X11 headers. But even after installing it, I still got the same error. I could not figure out the reason why <kbd>configure</kbd> was not finding the headers and libs. So after searching the GNU autoconf manual, I found a way to specify the X11 headers and libs on the command line.
<pre>./configure --x-includes=/usr/X11R6/include/X11/ --x-libraries=/usr/X11R6/lib/</pre>
This did the trick. I'm not sure why it worked the first time and not the second time. See the <a href="http://www.gnu.org/software/autoconf/manual/autoconf.html">GNU Autoconf manual</a> for more information about the <kbd>configure</kbd> script.</p>
See also <a href="http://www.saltycrane.com/blog/2007/09/cygwin-x-ratposoin-screen-rxvt-setup/">Cygwin, X, ratposoin, screen, rxvt setup</a>