top back button to main index

Using the calm window manager

The calm window manager (cwm) is a "lightweight and efficient window manager for X11" written mostly by Marius Eriksen. It purports to "maintain the simplest and most pleasant aesthetic."

The control keys are fairly simple (CTRL, META, and SHIFT):

CM-Return   Spawn a new terminal.
...
M-Return    Hide current window
...
M-Question (?)  Spawn "exec program" dialog.
M-Period (.)    Spawn "ssh to" dialog.

There are 35 odd-ish key bindings. That's not too bad. cwm's "GROUPS" concept makes it easy to simulate "virtual desktops". Groupings can be traversed via arrow keys.

One can move windows about with key bindings one would use if one were familiar with vim (i.e., h j k l).

Configuration is pleasant and straightforward (.cwmrc):

command firefox  firefox
command shot     scrot
command pad      "xterm -e ed /home/joe-user/yellowpad.md"

borderwidth 1
# Inherit groups 
sticky yes

# Define a “gap” in pixels at the edge of the screen. Maximized windows will not overlap gap area.
gap 24 0 0 0
# Ignore programs by name, not drawing borders around them.
ignore sbar_ip
ignore sbar_time

# miss i3? Snapping made easy:
bind-key CM-Right       window-snap-right
...
    # brightness keys on an X280 ThinkPad
bind-key XF86MonBrightnessUp    "light -A 10"
bind-key XF86MonBrightnessDown  "light -U 10"

Applications listed in the config such as firefox can be selected with C-Question, which allow one to open them quickly. As mentioned, M-Period will spawn an ssh session which reads one's .ssh/config. Use M-Question if the command isn't listed in your config. Recall that this opens the "exec program" dialog.

Ersatz tiling can be achieved with key-bindings for window snapping (see above).

Using cwm with NixOS

Using X without a Display Manager on NixOS isn't intuitive but easy to do nevertheless.

Here's my configuration XServer block:

  # Xserver 
   services.xserver = {
    enable = true;
    # We don't want to autorun X; we want startx 
    autorun = false;
    # Whether to symlink the X server configuration under /etc/X11/xorg.conf. 
    exportConfiguration = true;
    displayManager.startx.enable = true;
    windowManager.cwm.enable = true;
  };

Ryan Chan has written an excellent blog post that was invaluable. Many thanks to him.

The contents of .xinitrc:

#!/usr/bin/env sh

xrdb -load $HOME/.Xresources

# status bars shape and location should be updated
# and sbar stuff placed on PATH if missing
# otherwise, ignore this

xterm -cr white -g 13x1+30+0   -hold -e sbar_ip &
xterm -cr white -g 17x1-0+0    -hold -e sbar_time &
xterm -cr white -g 4x1+0+0     -hold -e sbar_bat &

$HOME/.fehbg & # wallpaper

exec cwm

Here are helpful links for those interested in cwm and more:

  • cwm(1)
  • cwmrc(5)
  • Getting started with cwm
  • Netbooting OpenBSD - cwm is an official window manager for OpenBSD and works well there too. Reading this one will learn more than one cares to regarding OpenBSD and net booting basics. Getting the cwm running with X forwarding is not covered as yet.
bottom button to main index

Valid XHTML 4.0!

Valid CSS!

Learn CSS


site last modified: 21-11-2022
Ryan J.P. Casalino © 2015 - 2022