dwm, short for dynamic window manager, is a minimalist window manager for the X Window System that arranges windows automatically in tiled, monocle and floating layouts and is configured by editing a C header file and recompiling. On the Linux desktop, it is the reference example of the suckless philosophy: a deliberately small code base, often cited at around 2,000 lines of C, that users are expected to read and modify themselves.
Unlike full desktop environments such as GNOME or KDE Plasma, dwm provides only window placement, a status bar and keyboard bindings. Everything else, including the launcher, terminal, notifications and session management, comes from separate programs chosen by the user.
How dwm manages windows
dwm is an X11 client that takes over window management by selecting substructure redirection on the root window, which means the X server forwards every map, configure and destroy request to dwm instead of acting on it directly. dwm then computes the geometry of each visible client according to the active layout and tells the server where to draw it.
The default tiling layout splits the screen into a master area and a stack area. The master area holds the most important window, typically an editor or browser, while the remaining windows share the stack. Two parameters control this split: mfact, the master width fraction with a default of 0.55, and nmaster, the number of windows in the master area with a default of one.
The following table describes the three layouts that ship with dwm.
| Layout | Bar symbol | Window arrangement | Typical use |
|---|---|---|---|
| Tile | []= | Master on the left, stack on the right | Coding beside terminals |
| Monocle | [M] | One maximized window at a time | Small screens, focused reading |
| Floating | ><> | Free positioning with the mouse | Dialogs and image editors |
Tags instead of workspaces in dwm
dwm organizes windows with tags rather than fixed workspaces. Each window carries a bitmask of tags, nine by default, and the screen shows every window whose tags intersect the currently viewed set. A window can therefore appear under several tags at once, and several tags can be viewed simultaneously.
This model is more flexible than numbered workspaces, such as the workspaces of i3 or Sway. For example, a chat client tagged with both 2 and 5 is visible in either context, and viewing tags 1 and 3 together merges two task groups temporarily without moving any window.
| Binding | Action | Effect |
|---|---|---|
| Mod1 and a number | View tag | Shows windows with that tag |
| Mod1, Shift and a number | Tag window | Moves the focused window to that tag |
| Mod1, Ctrl and a number | Toggle view | Adds or removes a tag from the view |
| Mod1 and Return | Zoom | Swaps the focused window into the master area |
| Mod1 and h or l | Resize master | Decreases or increases mfact |
The default modifier is Mod1, the Alt key, which many users change to Mod4, the Super key, to avoid conflicts with application shortcuts.
Configuring dwm through config.h
dwm has no runtime configuration file. Settings such as fonts, colors, key bindings, window rules, tag names and layout parameters live in config.h, which is created from config.def.h on the first build. Every change requires recompiling and restarting dwm, a design choice that keeps the parser out of the code base and makes the binary start in milliseconds.
Additional features are added through community patches, which are plain diff files applied with the patch tool. Popular patches add gaps between windows, a system tray, extra layouts or per-tag layout memory. Because patches modify the same small source files, applying several patches often causes merge conflicts that must be resolved by hand.
The status bar shows the text of the root window name. Users set it with a shell loop or a small program that calls xsetroot -name every few seconds with the time, battery level or network state.
How dwm compares with other Linux window managers
dwm sits at the most minimal end of the tiling window manager spectrum. The table below contrasts it with neighbors that Linux desktop users commonly evaluate.
| Window manager | Display server | Configuration method | Tiling model |
|---|---|---|---|
| dwm | X11 | C header and recompilation | Automatic master and stack |
| i3 | X11 | Plain-text configuration file | Manual tree of containers |
| Sway | Wayland | i3-compatible text file | Manual tree of containers |
| bspwm | X11 | Shell script with bspc | Binary space partitioning |
| Hyprland | Wayland | Text file with live reload | Dynamic with animations |
The closest Wayland equivalent is dwl, a separate project that follows the same principles on the wlroots library. dwm itself runs on Wayland sessions only indirectly, because it depends on Xlib and the X.Org Server.
Limitations and common mistakes with dwm
The minimalism of dwm is a deliberate trade-off between simplicity and convenience, and new users often meet the same obstacles.
| Problem | Cause | Solution |
|---|---|---|
| Changes have no effect | config.def.h edited instead of config.h | Edit config.h and rebuild |
| Java applications show gray windows | Toolkit does not recognize the window manager | Set the variable _JAVA_AWT_WM_NONREPARENTING=1 |
| Empty status bar | No program sets the root window name | Run a status script with xsetroot |
| Patch fails to apply | Patch written for another dwm version | Use the matching version or merge manually |
| No tray icons | dwm has no system tray by default | Apply the systray patch or use a separate tray |
dwm also offers no built-in session saving, compositor or display configuration, so tools such as picom, xrandr and a display manager or startx script must be set up separately. These gaps are intentional, yet they make dwm unsuitable for users who expect a complete desktop out of the box.
A non-technical view
dwm is a program that decides where windows go on the screen. Instead of letting people drag and resize windows by hand, it arranges them neatly side by side, like tiles on a floor, and lets the user switch between them with the keyboard.
It is very small and very fast, but it comes with almost nothing extra. Changing its behavior means editing a short text file of program code and rebuilding it, so it suits people who enjoy shaping their own tools.
A concrete example
A backend developer works on an older ThinkPad with 8 GB of memory running Arch Linux. A full desktop environment feels slow, so the developer installs dwm together with the st terminal and the dmenu launcher, both from the same suckless project.
In config.h, the developer changes the modifier to the Super key, sets mfact to 0.6, adds a window rule for the browser that always places it on tag 2 and builds dwm with make clean install. A short shell script updates the status bar every ten seconds with the battery level and the time.
With an editor in the master area and two terminals in the stack, the developer runs tests and logs without touching the mouse. Idle memory use of the graphical session drops to a few hundred megabytes, and the laptop remains responsive while compiling.