dwm Layout Configuration^

When you start Linux with a desktop environment like KDE or GNOME, the initialize process starts a window manager or compositor to handle how windows are drawn on the screen. Users of window managers tend to regard this as a somewhat bloated process, where the complexity of fancy screen renderings are introduced at the expense of fast functionality.

The basic mentality is: I don’t want fancy screen animations or adaptive shadows to move about when I ask it to do something. In fact, it would be best if the change happened so fast that my eye doesn’t have time to track the movement. That way I can instantly move from one thing to the next with minimal opportunity for distraction.

The layout controls determine how dwm draws windows on the screen.

Master Layout^

The way dwm tiles windows is to split the screen into two areas. There is a master area that is the main application you mean to operate on the current tab, then there is a secondary area that contains all other windows.

Note

The window in the master area is not the current active window. You can shuffle through these freely without retiling the screen.

There are two variables that relate to the master area: mfact and nmaster.

config.h^
35static const float mfact     = 0.55;
36static const int nmaster     = 1;

mfact is the factor of the master area size, which is a float constant that can range from 0.05 to 0.95. This affects the default size of the master area.

For example, in the tall layout a factor of 0.50 would mean that when two or more windows are open on the screen the master takes up half of the horizontal screen real estate.

nmaster indicates the number of clients that can occur in the master area. So, if you have nmaster set to 2, the third window you open bumps over to the secondary area while the first two remain in master.

Note

Although these settings are constants, they affect the default state of the window. You can readjust size after the windows are open and push windows in and out of the master area as need with shortcuts.

Resize Hints^

Resize hints are values passed from the application to the window manager to indicate how the application developer expects the user to view the window. This can be useful in cases where you are using a tiling layout but open a window that expects to be rendered in a much smaller size. It may also be that you are of the opinion that all windows should be tiled regardless of their hints.

The resizehints variable is an integer constant that indicates whether you want dwm to respect sizing hints it receives from the application.

config.h^
37static const int resizehints = 1;

A value of 0 indicates that dwm should ignore size hints.

Full Screen Lock^

The lockfullscreen variable is an integer constant that controls how dwm handles focus when you have a window in full screen while using the focus stack layout.

config.h^
38static const int lockfullscreen = 1;

When set to 1, dwm locks focus on the full screen window. This prevents you from switch focus off of the full screen window. The assumption is that if you have set a window as full screen you intend to only work in that window for a while. Accidentally shifting focus onto another screen distracts from task, so it would be good to disable this functionality for a time.

This option was introduced in dwm 6.3.

Layouts Configuration^

The layouts array configures the specific layouts available to your dwm build. A layout has two values:

  • A string that controls how dwm signals a layout as active in the status bar

  • An arrangement function that controls how it lays out the windows.

By default, dwm is set up with the tiling, floating, and monocle layouts.

config.h^
40static const Layout layouts[] = {
41     /* symbol     arrange function */
42     { "[]=",      tile },
43     { "><>",      NULL },
44     { "[M]",      monocle },
45};

If you find the symbols obscure, you change the strings to a more informative schema, such as "[T]", "[F]", and [M]. Or, you could utilize some fancy UTF-8 symbols to achieve a more iconic arrangement.

If you set the arrangement function to NULL, dwm defaults to a floating layout.

Using patches from Suckless, you can also add new arrangement functions to your builds or develop your own.

dwm Tag and Rules Configuration dwm Keyboard and Mouse Configuration