Ratpoison window manager


Ratpoison is a fast tiling window manager, written in C, which goal is to minimize the use of the mouse.


Install ratpoison


In Debian:

$ sudo aptitude install ratpoison


Get source code:

$ git clone git://git.savannah.nongnu.org/ratpoison.git


Launch ratpoison


If we want to launch it quickly, without setting anything:

$ startx $(which ratpoison) -- :2 # launch a new X server with ratpoison client in screen 2


Useful Key bindinds


C-t . # for menu

C-t ? # for help

C-t c # open a terminal

C-t a # display date

C-t w # list all windows

C-t A # set window title.

C-t k # kill current window.

C-t ! # execute a shell command.

C-t ' # select a window by its number or the beginning of its name(case insensitive).

C-t 1 # go to window number 1 (same for 2 - 9 numbers)

C-t s # split frame horizontally

C-t S # split frame vertically

C-t Tab # change focus to next window in frame

C-t Q # make current focused window the only one in frame

C-t r # resize frame using cursor keys and enter.

C-t R # remove current window from frame.

C-t f # select a window in current frame using numbers.

C-t u # undo a former command.

C-t U # redo undone command.

C-t x # swap current window with a selected by number one in current frame.

C-t F # show current window.

C-t C-t # go to last frame.

C-t t # send C-t

C-t : # execute a ratpoison command. E.g: bind d exec firefox to create a bind to firefox.
These commands could afterwards be added to .ratpoisonrc file

C-t b # banish the mouse to a corner of the screen.


Configure behavior of some X applications


We perform that editing $HOME/.Xresources file:

E.g:
emacs*Background:  black
emacs*Foreground: white
xterm*Background: black
xterm*Foreground: white
xterm*Font: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-15

Next we will need to load this file using xrdb command.


Configuration file to launch X when executing startx command


When we launch startx command, script $HOME/.xinitrc is executed:

E.g:
xrdb -merge ~/.Xresources
xscreensaver -no-splash &
xterm &
ratpoison &
wait

This script loads configuration properties for some X applications, launches xscreensaver, a terminal and executes ratpoison.

wait command waits for all other commands to finish.


Interesting ratpoison commands


We can enter these commands using C-t : or in Ratpoison configuration file.

set # show all settings.

bind # bind a key to a command. If that key was not free we need to execute unbind command before.

bargravity ne # set bar window to upper right corner (other values: nw, se, sw).

tmpwm # allow us to launch a temporary window manager. E.g to execute gimp application.

number # change number of a window.

select # select a window by its number or the beginning of its name(case insensitive).

exec # execute a program in another process.

msgwait # number of seconds command output is shown in the screen.
msgwait 0 # disables bar window auto-hiding, then the user shows and hide it calling windows or C-t w command.


Ratpoison configuration file


When launched ratpoison reads commands from its configuration file $HOME/.ratpoisonrc

An example:
set fgcolor white
set bgcolor black
#set font "courier"
#set font "fixed-10"
set font "courier-12"
set bargravity ne
#set bargravity sw
bind F1 exec dmenu_run
bind F2 restart
# launches a temporal window manager
bind F8 tmpwm
# finishes ratpoison
bind F9 quit

## needs (server-start) in .emacs file
#bind e exec emacsclient -a emacs $HOME

# find an existing emacs window
bind e select emacs
bind C-e select emacs

bind C-N number
msgwait 10


Lines starting with # are comments.


Reference


https://wiki.archlinux.org/index.php/Ratpoison

http://www.nongnu.org/ratpoison/

Ratpoison manual

Ratpoison wiki