How I use dwm

How I use my favorite tiling window manager all day, every day
Page created: 2017-03-24 , updated: 2023-07-21

See also:

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" (dwm tags) 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 (wikipedia.org) some number of years ago.)

Update: I’ve been using dwm with two monitors on several different desktops for a couple years now. Works great and multiplies the already excellent use of space.

Update2: Works great with three monitors, too. Picture at the bottom of this page.

Super key

Instead of the default use of "Alt" as the MODKEY, I use the "Super" key aka "Mod4" or "The Windows Key" if you are uncouth.

It’s a simple modification, but one I highly recommend since the Super key is way less likely to conflict with shortcuts in terminal applications and other things.

Here’s my use-mod4.patch:

diff -Naur config.def.h b/config.def.h
--- config.h    2019-02-02 12:55:28.000000000 +0000
+++ b/config.h  2019-04-14 14:04:30.190258413 +0100
@@ -44,7 +44,7 @@
 };

 /* key definitions */
-#define MODKEY Mod1Mask
+#define MODKEY  Mod4Mask
 #define TAGKEYS(KEY,TAG) \
    { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \

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: Mod-Shift-Enter

  • Open an application with dmenu: Mod-p (then type part of the name and then Enter)

  • Move window to the left side (aka 'zoom'): Mod-Enter

    block diagram of zooming to toggle the focused window between the master and stack areas
  • Make a window fullscreen ('monocle' layout): Mod-m

  • Return to tiled layout: Mod-Space

  • Return to fullscreen: Mod-Space

  • Send a window to another "tag" desktop (example: 2): Mod-Shift-2

  • Go to another desktop (example: 2): Mod-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: Mod-j and Mod-k (I almost always use this in fullscreen mode to bring a different window to the front.

  • Increment/decrement the left side window count: Mod-i and Mod-d

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

Things I do rarely

  • Move a window with the mouse: Mod- plus left-click and drag

  • Resize a window with the mouse: Mod- plus right-click and drag

  • Return a floating window to tiled layout: Mod- plus scroll-wheel click (or Mod-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. Update: I use pass now, which is a terminal application.)

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.

Update: Scroll down for links to articles where I describe how I now manage dwm in a repo across installs.

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 (wikipedia.org)!)

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

Update: It’s grown quite a bit since then. See Personal Linux Setup link below.

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 (wikipedia.org).

My own personal dwm

I keep my personal copy of dwm in its own repo so I can easily deploy it to new computers.

You can read more about that in:

one landscape and two portrait monitors

For my setup containing two portrait-oriented monitors (shown above), I use this patch:

Adds Mod-U for a vertical version of the regular dwm layout and Mod-O for a purely "stacked plates" layout (which I’m currently favoring).

bottomstack has a great ASCII drawing of these layouts:

bstack        (TTT)       bstackhoriz   (===)
+-----------------+       +-----------------+
|                 |       |                 |
|                 |       |                 |
|                 |       |                 |
+-----+-----+-----+       +-----------------+
|     |     |     |       +-----------------+
|     |     |     |       +-----------------+
+-----+-----+-----+       +-----------------+

Works great!