Dave's Visual Guide to dwm

a screenshot of my desktop running dwm in tiling mode

dwm is a dynamic window manager for X. I'm so happy I found it. It's a perfect fit for my own personal usage patterns:

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

The documentation was a little austere and sometimes a picture is really worth a thousand words, so I've made a best attempt at showing how dwm works in a visual way.

The Mod1 key

In the documentation and man page, dwm refers to a key called Mod1 which is used in all key bindings. The default is the Alt key on my keyboard.

Layouts

Tiled (the default)

The first window starts out fullscreen. As windows are added, they are opened in the larger "master" area to the left. Older windows are pushed onto the "stack" area. The below image shows this progression:

block diagram of the default tiling layout

This layout is dwm's raison d'etre and I use it 99% of the time.

Layout keybindings

Mod1-t - tiled layout - re-arranges windows into the dynamically-tiled master/stack configuration (if not already).

block diagram of switching to tiled layout

Mod1-m - monocle layout - very handy, single window fullscreen layout - whichever window is focused is pushed to the front and viewed fullscreen. Switch windows by focusing them (see below).

block diagram of switching to monocle layout

Mod1-f - floating layout - allows windows to overlap and be moved and sized manually.

Note: nothing will appear to change when you switch to floating layout since all windows will still have the same size and position.
block diagram of the evil floating layout

Mod1-space - toggle layouts - this toggles between the most current two layouts.

Mod1-Shift-space - toggle window layout - for the focused window, this toggles between tiled and floating states.

block diagram of toggling a window between floating and tiled states

Opening and closing windows

By default, there are two ways to open a new window: open an st terminal or run dmenu. Both of these are separate applictions which were constructed specifically to work with dwm. I like them both. Here are the default keybindings for each:

Mod1-Shift-return - open terminal - this specifically opens st, if you want it to open another terminal, you'll need to customize config.h.

block diagram of opening a new terminal in dwm

Mod1-p - open dmenu - runs the tiny dynamic menu called dmenu in dwm's top bar.

I really like dmenu. It lets you find available applications by typing parts of their names. For example, to launch Firefox on my system, I just press Alt-p, type fire (though just fir is all I need) and hit return.

To close a window, you can either quit it from within the application, or tell dwm to close the window with this keybinding:

Mod1-Shift-c - close focused window

block diagram of a window being closed

Switching window focus

Mod1-j - focus next window - in the tiled layout, this goes in clockwise order.

block diagram of focusing the next window in the tiled layout

or floating:

block diagram of focusing the next window in the floating layout

Mod1-k - focus previous window - in the tiled layout, this goes in counter/anti-clockwise order.

block diagram of focusing the prev window in the tiled layout

or floating:

block diagram of focusing the prev window in the floating layout

Tiled layout shortcuts

Mod1-i - increment master - increase the number of split windows in the master area (will move windows (if any) out of the stacking area as needed).

block diagram of incrementing the master area windows

Mod1-d - decrement master - decrease the number of split windows in the master area (will move windows (if any) back to the stacking area as needed).

block diagram of incrementing the master area windows

Mod1-l - increase master area size - make the master area physically larger.

block diagram of making the master area larger

Mod1-h - decrease master area size - make the master area physically smaller.

block diagram of making the master area smaller

Mod1-Return - zoom - toggle window between the master and stack areas: if the focused window is in the stack, it is moved to the master area and the previous master window is put at the top of the stack; or if the focused window is in the master area, it is put on the stack.

block diagram of zooming to toggle the focused window between the master and stack areas

Tags

If you're used to the concept of multiple desktops or virtual desktops, this gives you the same functionality, but with more flexibility. A tag is like a desktop in that it can view a specific set of windows you have open. A tag is unlike a desktop in that a window may belong to more than one tag and you can even view all tags at once. It's very simple in practice and you only need to learn a few key combinations:

Mod1-Shift-[1..n] - apply tag to window - assigns the tag number to the currently-focused window (like moving a window to a different desktop).

Example: Alt-Shift-2 assigns the tag '2' to the current window. If you're currently viewing, say, tag '1', this will make the window disappear until you view tag '2'.
block diagram of assigning a tag to a window

Mod1-[1..n] - view tag - displays all windows with tag number (like viewing a particular desktop).

Example: Alt-2 displays all windows assigned to tag '2'.
block diagram of viewing a specific tag

Mod1-Tab - toggle tags - this is like switching between the two most recent desktops.

Mod1-Shift-0 - apply all tags to window - this is like saying "put this window on all desktops."

block diagram of applying all tags to the current window

Mod1-Control-Shift-[1..n] - toggle tag n - this adds or removes the tag number for the focused window (like adding or removing the window from a particular desktop).

Mod1-0 - view all windows - regardless of tag (like viewing all desktops at once).

block diagram of viewing all open windows

Mod1-Control-[1..n] - banish tags - Add/remove all windows with nth tag to/from the view (only makes sense in the context of the above option of viewing all windows).

Quitting dwm

Mod1-Shift-q - quit dwm - You shall return whence you came!

Toggle the top bar

Mod1-b - toggle the top bar - It is like a magic appearing/disappearing act! What fun!

block diagram of toggling the top bar

Mousing around

I'll be the first to admit that the mouse has its place. Sometimes you just have to click on a floating window and drag it away to paradise. dwm handles this intuitively (once you know to hold down the Mod1 key).

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

Mod1-Button1 - move window - Hold and drag to move the window. If the window was tiled, it will be floated (the rest of the layout will remain tiled - it's the best of both worlds!)

Mod1-Button2 - toggle layout - toggles the focused window between the floating and tiled state.

Mod1-Button3 - resize window - Hold and drag to resize the window. As with moving, if the window was tiled, it will be floated.

Screens

At the time of this writing, I don't have multiple monitors running on my system, so I won't presume to make graphics for these operations. However, here are the shortcuts for the sake of completeness:

Mod1-, - focus previous screen

Mod1-. - focus next screen

Mod1-Shift-, - send window to previous screen

Mod1-Shift-. - send window to next screen