dwm

dwm is a dynamic window manager for X. It manages windows in tiled, stacked, and full-screen layouts (as well as many others with optional patches). Layouts can be applied dynamically, optimizing the environment for the application in use and the task performed. dwm is extremely lightweight and fast, written in C and with a stated design goal of remaining under 2000 source lines of code. It provides multi-head support for xrandr and Xinerama

Build and install package

This will compile dwm, build an Arch Linux package containing the resulting files, and install the package file all in one step. If problems are encountered, review the output for specific information.

Note: If you save this directory (~/dwm) you can use it again to make changes to the default configuration as described below.

Configuration

dwm is configured at compile-time via its source (Template:Filename and Template:Filename) and must be recompiled whenever making changes. The initial configuration provides a good set of defaults, but at some point you'll probably want to make changes. For patches, customisations, etc., please visit the dwm website.

Method: ABS Rebuild (recommended)

If you followed method 2 of the installation phase, then modifying dwm is quite simple.

Customizing config.h

Browse to the dwm source code directory you saved during the installation process (~/dwm in the example). The config.h found within this directory is where the general dwm preferences are stored. Some settings within the file should be self-explanatory, while others may not be. For detailed information on these settings, see the dwm website.

Be sure to make a backup copy of config.h before modifying it, just in case something goes wrong.

Once your changes have been made, pipe the new md5sums into the PKGBUILD:

$ makepkg -g >> PKGBUILD

This will eliminate a checksum mismatch between the official config.h and your revised copy.

Tip: You can also erase the md5sum array and build dwm with the --skipinteg option (eg. makepkg -efi --skipinteg).

Now to compile and reinstall:

$ makepkg -efi

Assuming your changes were valid, this command will compile dwm, build and reinstall the resulting package (see makepkg -h for details). As before, if problems were encountered, review the output for specific information.

Restart dwm in order to apply the changes.

Tip: To restart dwm without logging out or closing applications, see the section: Starting dwm

Method: Mercurial (advanced)

dwm is maintained upstream within a Mercurial version control system. If you are already familiar with mercurial, then maintaining your configurations and patches within this system may be more convenient. A detailed tutorial on this method is available at the dwm website.

If you would like to build dwm from the Mercurial sources, be sure to change config.mk accordingly. Failure to do so may result in X crashes. Change the following values:

Change PREFIX to:

PREFIX = /usr

Change the X11 include folder to:

X11INC = /usr/include/X11

Change the X11 lib to:

X11LIB = /usr/lib/X11

Patches & Additional tiling modes

The patches page in the official website is full of patches that can add extra functionality to dwm. Users can easily customize dwm applying the patches they like. The Bottom Stack patch provides an additional tiling mode that splits the screen horizontally (opposed to the default tiling mode).

Conky statusbar

conky-cli, available from the AUR is a special build of conky which prints to stdout. If you're already familiar with conky, a statusbar rich with information can be ready within minutes. Once you have configured conky to your liking, simply print it to the statusbar via the Template:Codeline argument:

Tips & Tricks

Fixing gaps around terminal windows

If you find that there are empty gaps of desktop space outside your terminal windows, it is likely due to your terminal font size. You can either tweak the size until you find a sweet spot that closes the gap, or you can toggle Template:Codeline to False in your config.h file:

This will cause dwm to ignore resize requests from client windows--this will affect all windows, not just terminals. The downside to this workaround is that some terminals may suffer redraw anomalies (ghost lines, premature line wraps, etc.).

Restart dwm without logging out or closing programs

If you would like to restart dwm without logging out or closing applications, change your startup script to load dwm in a while loop, like this:

Now, you can restart dwm without destroying other X windows by pressing the usual Mod-Shift-Q.

It's a good idea to place the above startup script into a separate file, such as Template:Filename and execute it via ~/.xinitrc. Then when you want to actually end your session you can simply execute Template:Codeline (better yet, bind it to a key).

Make Alt_R key work as if it were Mod4 (Windows Key)

If you use Mod4 (aka Super/Windows Key) as your MODKEY, you might find it equally convenient to have your Right Alt key act as Mod4. This will allow you to perform otherwise awkward keystrokes one-handed, such as zooming with Alt_R+Enter.

First, find out which keycode is assigned to Alt_R:

xmodmap -pke | grep Alt_R

Then simply add the following to your startup script (e.g. ~/.xinitrc), changing the keycode 113 if necessary to the above result: