Sunday, December 1, 2013

cwm notes for OpenBSD

This year I've tried to use more of OpenBSD's base tools with little or no configuration files. Two that I focused on were tmux and cwm. I've been using tmux since before it was added to the base system, but I had tried to make it look and feel like GNU/screen. I stopped that nonsense. Now, my .tmux.conf is very minimal:

set -g status-keys vi
setw -g mode-keys vi

But I had been using spectrwm for my window manager. And a good friend, Andrew Fresh (afresh1), suggested that I try out cwm(1). So I did.

At first cwm is off-putting. There are no menus and if you lose your one xterm (with which you can run `man cwm`), you're screwed.

For the purposes of this post, C=control, M=alt, 4=windows-key, S=shift.

Some quick notes that are helpful:

CM-Enter spawns a new xterm

CM-= maximizes the window vertically

CMS-= maximizes the window horizontally

MS-/ spawns exec menu (MS-/, then "firefox" launches Firefox)

CM-[n] selects window group [n]

CM-0 selects all groups

CM-g adds currently selected window to currently selected group

CMS-r restarts cwm (re-reading .cwmrc)

CMS-q quits

You can also resize windows using the keyboard. You can move and resize windows with the mouse too. These are described well in the man page.

However, the thing that I found hardest to grasp was how to use window groups as virtual desktops. And the piece that I was missing was that I hadn't read cwmrc(1). There are two directives that aren't included in the default keyboard shortcuts list: grouponly[n] and movetogroup[n] (where [n] is the number corresponding to window groups 1-9).

You can select a group and add a window to it. And you can toggle that group's visibility with CM-[n].

But, window groups get more powerful when you can select a window group while hiding windows in any other group.