wmii like cwm configuration on OpenBSD

The default OpenBSD window manager is FVWM. But OpenBSD also comes with the awesome, very simple cwm. I usually use wmii or something similar. But since I installed OpenBSD on a netbook, even wmii seemed like overkill. I don’t really need a lot of tiling here and I don’t want to waste any screen estate for the small bar wmii comes with.


So I just had a look around on my new install to see whether there is something I could use without installing any additional packages. That’s when I came across cwm.

It’s very simple to configure, you basically just create a .cwmrc file which tells it how to behave. As with everything in OpenBSD you don’t have to bother searching the web, you just type
$man cwm
$man cwmrc
and get all the information you ever wanted. But let me still write down my configuration here. Just in case I loose it or anything.

command lock "xscreensaver-command -lock"

# Shortcuts to start applications
bind 4-Return st
bind 4-e emacs
bind 4-m "emacs -e gnus"
bind 4-w firefox
bind 4-p exec

# Window management shortcuts
# mostly shamelessly stolen from wmii
bind 4-space maximize
bind 4-f search
bind 4-Tab cycle
bind 4-1 grouponly1
bind 4-2 grouponly2
bind 4-3 grouponly3
bind 4-4 grouponly4
bind 4-5 goruponly5
bind S4-1 movetogroup1
bind S4-2 movetogroup2
bind S4-3 movetogroup3
bind S4-4 movetogroup4
bind S4-5 movetogroup5
bind 4-t vtile
bind S4-c delete

# Mousecursor movement
bind S4-Right bigptrmoveright
bind S4-Up bigptrmoveup
bind S4-Down bigptrmovedown
bind S4-Left bigptrmoveleft
bind 4-Right ptrmoveright
bind 4-Down ptrmovedown
bind 4-Left ptrmoveleft
bind 4-Right ptrmoveright

# wm management
bind S4-r restart
bind 4-l lock
bind S4-q quit

# Moving around windows
# as you would in wmii
mousebind 4-1 window_move
mousebind 4-3 window_resize

# Use window groups to emulate desktops
sticky yes
# Don't draw a frame around conky
ignore conky

# Unbind some default key combinations
# because I need them in Firefox
# or Emacs
bind M-Tab unbind
bind M-Left unbind
bind M-Right unbind

Of course I also had to set up .xsession (if you use xdm or any other desktop manager) or .xinitrc (if you start x using startx). I went for xdm. Because I like the Ctrl-Alt-Backspace way to kill X. But without xdm this gives anyone a way to get around my screen locker, which makes locking the screen and encrypting the hard drive pretty useless. So this is my .xsession file:

xmodmap .Xmodmap
xsetroot -solid black &
xscreensaver -no-splash &