See also how I use dwm!
The official documentation is a little austere and sometimes a picture is really worth a thousand words.
The Mod1 key is 'Alt'
Before we get to the pictures, there’s one important detail we need to get out of the way:
the key dwm refers to as
Mod1, which is used in all key bindings.
Mod1 is ALT (or equivalent) on your keyboard.
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:
This layout is dwm’s raison d’etre and I use it 99% of the time.
Mod1-t - tiled layout - re-arranges windows into the dynamically-tiled master/stack configuration (if not already).
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).
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.
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.
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.
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
firis all I need) and hit
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
Switching window focus
Mod1-j - focus next window - in the tiled layout, this goes in clockwise order.
Mod1-k - focus previous window - in the tiled layout, this goes in counter/anti-clockwise order.
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).
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).
Mod1-l - increase master area size - make the master area physically larger.
Mod1-h - decrease master area size - make the master area physically 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.
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).
Alt-Shift-2assigns 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'.
Mod1-[1..n] - view tag - displays all windows with tag number (like viewing a particular desktop).
Alt-2displays all windows assigned to tag '2'.
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."
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).
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).
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!
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-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.
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