Dion Moult In honour of the late Dion Moult, 1992 - 2012In honour of the late Dion Moult, 1992 - 2012

Ratpoison: an efficient and minimalist WM.

Ratpoison. It sounds like something that kills a rat. It sure does. Ratpoison is a WM (Window Manager) that runs on Linux that has one purpose: to kill your rat.  Here we are referring to that disgusting little lump beside your keyboard that shoots lasers out of its arse.

Ratpoison is a tiling WM, which basically means that windows do not overlap.  They tile. An easy way to visualise this it by thinking of a table. 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 cells, switch values from one cell to another, split, remove and merge cells. Not only that, but you can do this using naught but your keyboard. It’s time to push that rodent away from your computer and appreciate the gazillion keys you already have to input information to your computer.

But why, you say, would I enjoy having to design a complex table layout for a simple task? For a number of reasons. Firstly, it’s damned fast. It’s so fast you can split em, switch em, merge em, and focus on what matters most: your work … not moving around windows so that you get a good look at them. Secondly, it uses up all your screen space. No wasting space on window borders, taskbars, panels, etc. Every single bit of your screen is showing useful information, and nothing more. This is often referred to as “efficient use of screen real estate”. Thirdly, it’s a minimal WM. This means it starts up quick, doesn’t have a gazillion dependencies, and is lightweight on your system space and resources.

Take a quick peek at this screenshot to show ratpoison in use (click for full resolution):

2009-02-09-005748_1280x800_scrot

Now terminal junkies would feel right at home here. The only time ratpoison doesn’t really play nice is with The GIMP, which has 3 windows. However splitting your screen into frames where the docks fit nicely into is good enough for most people. It’s just a bit of a hassle.

As you can see, ratpoison is basically shortcut driven. You use the keyboard to do everything: open new applications, close applications, resize windows, move windows … well, pretty much everything.

One thing I didn’t really like about ratpoison was the keybindings. The default ones look as though they were programmed by a drunkard (well, if you visit the official ratpoison website, and take a look at how they get inspiration, you’ll see they are drunkards). The solution to achieving a wonderful system is to use a combination of .ratpoisonrc settings and xmodmap settings. Here is a nifty guide that should get you started with some usable keybindings.

My RatPoison setup.

I’ll admit that I have not run ratpoison in a while. Recently I’ve hopped on the hip & trendy KDE 4.x bandwagon, and I love to see active development. All the same, the memories I’ve had with ratpoison have always been awesome, and that’s why I’m sharing it here.

Basically, the default ctrl-t to access the commands is stupid imho, because you have to stretch your hand and it hurts. 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 RP really fast!

So create a file called .xmodmaprc in your ~ 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 this:

xmodmap .xmodmaprc

Now you want to actually configure ratpoison. Create a .ratpoisonrc file in your ~ dir (yes, all these files are hidden with a . prefix). Put this code:

escape F13
bind Next exec amixer -q set PCM 2- unmute
bind Prior exec amixer -q set PCM 2+ unmute
unbind k
bind j focusdown
bind h focusleft
bind k focusup
bind l focusright
bind J exchangedown
bind H exchangeleft
bind K exchangeup
bind L exchangeright
bind C-k delete
exec /usr/bin/rpws init 4 -k
set winname class
defborder 0
defpadding 0 0 0 0
defbarpadding 0 0
bind space exec xterm

Alright. From top to bottom. First I say F13 (the caps lock) is now the new special key. Then I set my pageup and pagedown (next and prior) keys to control my volume (just because I like it. It’s not compulsory. The next bunch of binds basically make it so that it uses the Vim keys hjkl to move from left/down/top/right windows respectively. Then let’s say I want to switch the bottom window with the top one, I just do F13 + shift + k. So that’s basically F13 + capital K. K is the up key in vim, so it’s very logical and easy to use. I never have to move my hands anywhere on the keyboard when I want to switch windows. When I want to use alt tab, it’s even easier, just double tap the F13 key! The bind C-k delete is the shortcut to close the window. The exec rpws thing is simply if you have rpws installed (not sure if it’s there by default) it sets up virtual desktops. So ctrl-f1,f2,f3,f4 will switch between the 4. 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. Finally I use xterm a lot, so I find it easy to just do F13+space to quickly launch it.

There are lots of documentation available on what else to put in your .ratpoisonrc to configure it more. In these following lines what I have done is turned 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! Nifty!

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.

Well. Good luck with ratpoison, and I hope you enjoy using it. I know I have!

No related posts.


6 Comments

deadcabbit says: (13 May 2009)

I used ratpoison a bit, but I found it way too minimal for me: it’s like “screen” in a big xterm window – and while the screen splitting works for some apps, it’s a pain for others.

Dion Moult says: (13 May 2009)

@deadcabbit: Agreed, even though most terminal apps feel right at home there, some GUI apps can get you feeling a bit irksome – eg: Dolphin.

Hessiess says: (13 May 2009)

One aria where tiling WMs rally shine is on laptops with those awful touch pad mice. Personally I feel that user interfaces on laptops should be completely redesigned to be mouse free, it is massively more convenient that struggling with twitchy touch pad mice and you don’t need to carry around a reel mouse, or find some were stable for using one.

I use a customised version of dwm (no bar, wasted too much screen space) and have also bean playing with stumpwm, DWM’s auto tiling is much more efferent as it completely removes the need to manage windows manually, saving a lot of time.

I also have application launchers for commonly used programs mapped to the keyboard, i.e. super+c lauch XFCE terminal, super+f launch firefox etc.

Dion Moult says: (14 May 2009)

@Hessiess: remind me to check out DWM ;)

My hands are somewhat weird in the respect that they tend to sweat profusely when interacting with certain materials – one of these is the material used in track pads – hence making them completely useless for me. Ratpoison is a huge lifesaver in this case, especially when on the go.

Tweets that mention thinkMoult - Ratpoison: an efficient and minimalist WM. -- Topsy.com says: (23 November 2010)

[...] This post was mentioned on Twitter by mindassistfeed, John Bloebaum. John Bloebaum said: thinkMoult – Ratpoison: an efficient and minimalist WM.: http://bit.ly/e3XvwA [...]

rogue says: (17 October 2011)

Thanks for the tips Dion! I just started using ratpoison about a week ago and I’m loving it. The Ctrl+t thing bugged me a little bit though from the start; and so remapping it to Caps Lock is great!

On a side note, it is not possible to comment the xmodmap file that you create in your home dir without X throwing errors. Maybe everyone knows that, I didn’t. :)

Leave a Comment