How I use dwm

How I use my favorite tiling window manager all day, every day
Created: 2017-03-24 and last updated 2018-09-08
Tagged: linux dwm productivity

See also my visual guide to dwm!

Note: I’m going to use "Alt" instead of "Mod1", "desktop" instead of "tag", and "fullscreen" instead of "monocle" in this article. I use the official terminology in my visual guide linked above.

Why dwm?

It leaves nearly 100% of the screen real estate for me to use.

It starts almost instantly on my underpowered desktop.

It perfectly mirrors my own personal usage patterns:

  • I do not ever want to manually resize or move a window if I don’t have to
  • I usually have least two windows open side-by-side
  • I sometimes want to make a window fullscreen
  • I always want to use all available screen space for displaying content
  • I like to use "multiple desktops" to manage applications
  • I want keyboard shortcuts for everything

dwm puts windows exactly where I would have put them, but I don’t have to lift a finger. It’s like it was made specifically for me.

a screenshot of my desktop running dwm in tiling mode

In fact, dwm makes it so easy to move windows around that I almost never miss having multiple monitors. (I lost my second monitor to the release of the magic smoke some number of years ago.)

Things I do constantly all day long

After a year of use, all of this is completely trained into my muscle memory and I do it automatically:

  • Open a new terminal: Alt-Shift-Enter
  • Open an application with dmenu: Alt-p (then type part of the name and then Enter)
  • Move window to the left side (aka 'zoom'): Alt-Enter

    block diagram of zooming to toggle the focused window between the master and stack areas
  • Make a window fullscreen: Alt-m
  • Return to tiled layout: Alt-Space
  • Return to fullscreen: Alt-Space
  • Send a window to another desktop (example: 2): Alt-Shift-2
  • Go to another desktop (example: 2): Alt-2

These commands alone constitute 95% of what I need, making dwm the most productive environment I’ve ever worked in.

Things I do occasionally

  • Cycle window focus: Alt-j and Alt-k (I almost always use this in fullscreen mode to bring a different window to the front.
  • Increment/decrement the left side window count: Alt-i and Alt-j

    block diagram of incrementing the master area windows
    block diagram of incrementing the master area windows
  • Close a window: Alt-Shift-c

Things I do rarely

  • Move a window with the mouse: Alt- plus left-click and drag
  • Resize a window with the mouse: Alt- plus right-click and drag
  • Return a floating window to tiled layout: Alt- plus scroll-wheel click (or Alt-Shift-Space)

    block diagram of clicking on a floating window and taking it away to paradise

My configuration

Changes to dwm are made in source, typically by modifying config.h. I’ve made very few changes. Specifically I’ve commented out the special handling of Gimp and Firefox and added the isfloating flag for Qemu virtual machines:

/* class         instance    title       tags mask     isfloating   monitor */
/*{ "Gimp",        NULL,       NULL,       0,            1,           -1 }, */
/*{ "Firefox",     NULL,       NULL,       1 << 8,       0,           -1 }, */
{ "Qemu-system-x86_64", NULL,  NULL,       0,            1,           -1 },

(And I just recently copied the "Gimp" entry because I wanted to make Keepassx (my password manager) float.)

Once you start modifying dwm, you’re basically maintaining your own fork. I’m storing my copy in its own projects directory, ~/proj/dwm/ and have the binary symlinked to my personal ~/bin/ dir.

To start dwm when I power on my Slackware Linux desktop, I manually enter startx on the command line. (otherwise I would miss the fortune!)

Here’s the entirety of my current .xinitrc:

# dwm statusbar - show current date and time
while true
do
	xsetroot -name "$(date "+%F %R")"
	sleep 1m
done &

# start dwm
exec /home/dave/dwm/dwm

You can set the dwm 'name' to be the output of whatever command you want (date in this case). It will show up in the upper right corner. I like this simple loop because it shows the date and time in The One True Format.