Ratpoison is a tiling window manager, with a focus on removing the need to use your mouse (get it?) under any circumstances whatsoever. It's extremely efficient and minimalist.
For those new to tiling window managers, there are generally two paradigms to displaying software on your screen. The most famous method is known as a "floating" window, where you have floating, rectangular panels, each of which contain the interface of different software. These rectangles can overlap, and have options to maximise, resize, restore, and minimise, often coupled with a task bar which shows all the windows you have open and features to launch new windows.
There is an alternative to floating window management! It's called tiling window management. Imagine carving up your monitor into tiles, and each tile contains the interface of each software.
Similar to a table in a spreadsheet, a table can have rows and columns split up into as weird a configuration you can think of, but there is only one value per cell, and that value cannot overlap another cell. You can resize your tiles, switch values from one tile to another, split, remove and merge tiles.
There are a lot of tiling window managers out there, but I'd like to focus today on Ratpoison.
Ratpoison shares all the benefits of other tiling window managers:
- Your screen real estate is dedicated purely to showing content, not decoration.
- The location of that content is predictable and consistent.
- Generally lightweight, as any additional content (notification trays, status bars, menus) are usually explicitly configured and added by yourself.
Ratpoison's premise (again, like most tiling window managers), is that you should be able to control your window placement purely using keyboard shortcuts. You use the keyboard to do everything: open new applications, close applications, resize tiles, move tiles, and so on.
There are two things which set Ratpoison apart:
- Ratpoison is bare bones. It does what it's meant to do, and that's it. Other tiling window managers might offer more candy, but ratpoison chooses its friends.
- Ratpoison is modeled after GNU screen. This makes it easy for those already familiar with terminal management to use their graphical environment in a similar manner. tmux users will be happy too.
Just like GNU Screen, Ratpoison uses a "command key" to prefix any commands
that are sent to it. For example, if you want to split a tile, you first press
the command key, then press the S
hotkey to split. This helps distinguish
between regular hotkeys that your software is listening to, and Ratpoison
hotkeys.
My Ratpoison setup.
The problem with this is that the default ratpoison bindings, whilst it may be familiar to those who use GNU screen, may not be the most ergonomic. I'm a fan of Vi-keys, so if you are too, here's a setup using a combination of .ratpoisonrc settings and xmodmap settings.
By default, the command key is set to Ctrl-T
. This hand-stretching
combination isn't the most comfortable sequence and can get tiring after a
while. So the first thing I do is remove my Caps Lock
key (nobody ever uses
it anyway) and change it to an imaginary key called F13
. This way all I have
to do is shift my left pinky slightly to the left when I want to do something.
This makes using Ratpoison really fast! So create a file called .xmodmaprc
in
your home directory, and put this in it:
remove lock = Caps_Lock
keycode 66 = F13
Next thing you want to do is make sure these key changes take effect before you
start the X server. So in your .xinitrc
file in the ~ directory, before the
exec ratpoison
line, add xmodmap .xmodmaprc
.
Now that Caps Lock has been redefined to be F13
, you will want to configure
Ratpoison to use it as the command key. Create a .ratpoisonrc
file in your
home dir (yes, all these files are hidden with a . prefix). Put this code:
escape F13
. That's it!
I have extended my Ratpoison setup to also use Vi-keys for navigation. The idea
is that hjkl
will navigate between window tiles, and HJKL
will move window
tiles. I find this quite intuitive. I also use the page up and page down keys
to control the volume. I also use polybar
, which is a popular status bar, and
bind the spacebar to open up a new xterm
, which is by far the most common
program that I launch. Here's the setup:
# Set the imaginary F13 key (i.e. the Caps Lock) as the command key
escape F13
# Page up/down volume control
bind Next exec amixer -q set PCM 2- unmute
bind Prior exec amixer -q set PCM 2+ unmute
# Vi-key navigation
unbind k
bind j focusdown
bind h focusleft
bind k focusup
bind l focusright
# Vi-key tile swapping
bind J exchangedown
bind H exchangeleft
bind K exchangeup
bind L exchangeright
bind C-k delete
# Create 4 virtual desktops
exec /usr/bin/rpws init 4 -k
# Set a wallpaper
exec /usr/bin/fbsetbg /home/dion/Images/Wallpaper.jpg
# Create a status bar at the top
exec polybar moult
# Set no borders, and a 25px padding at the top for the status bar
set winname class
set border 0
set padding 0 25 0 0
set bgcolor #333333
set fgcolor #CCCCCC
set barborder 0
# The space bar will launch a terminal
bind space exec xterm
You might notice that rpws
and fbsetbg
is called. rpws
sets up virtual
desktops. So Alt-{F1,F2,F3,F4}
will switch between the 4 virtual desktops.
fbsetbg
sets the desktop wallpaper to an image I have created. set winname
class
makes the window names something intelligent than the default. The
border and paddings simply reduce the space between applications so I get 100%
screen real estate used. There are lots of documentation available on what else
to put in your .ratpoisonrc to configure it more.
Another trick is to turn my Windows Key (Hyper_L
) into a special key, so that
when combined with another key, it launches one of my favourite programs, or
even controls my music player! Here's an example:
definekey top Hyper_L thisIsNotAWindowsKey
definekey top H-f exec firefox-bin
definekey top H-o exec ooffice
definekey top H-b exec blender
definekey top H-p exec mpc toggle
definekey top H-bracketleft exec mpc next
definekey top H-bracketright exec mpc prev
Don't forget if you want to try out the commands real time, use F13
(or whatever modifier) + :
then type your command that you would use in your
.ratpoisonrc
. If you want to run a shell command or app, just do F13
+ !
then type it in.
On those rare occasions where you don't want to tile your windows, a final
trick is to use the tmpwm
command inside Ratpoison to temporarily switch to
another window manager. I use Fluxbox as an alternative minimal window manager
for this purpose. So for example, you can do :tmpwm fluxbox
, then when you're
done, just quit Fluxbox, and ratpoison will resume.
Alternatively, you can also use Xephyr.
Well. Good luck with Ratpoison, and I hope you enjoy using it. I know I have!