You can probably download a packaged version of dwm for your distribution that will work 'as is'. If you want to do any configuration, including changing the Mod key, you will have to edit a file called config.h, which is available if you get the tarball from

Having unpacked the tarball somewhere in your home directory, you run 'make' to produce config.h. Edit this as required and run 'make install' to compile dwm and install an executable file in /usr/local/bin. Edit .xinitrc or whatever you use to start X to reflect the change, and restart X. You should now be running dwm with your modifications. Any errors will be reported on-screen. (See below for other changes that may be needed for .xinitrc.)

All the dwm source files, including config.h, are written in C. This is fine if you know C, but even if you don't and are not a programmer (I'm not), it's pretty easy to modify it. If you look through the lines of code it's mostly pretty obvious what they do, and you can make your own modifications using what you find as a model. For example, I added new commands to run my browser (Iceweasel) and my mail reader (Mutt). I also made Mod-Tab and Mod-Shift-Tab work the same way as they do in xmonad.

If anything isn't clear, have a look at the site, which provides examples of configuration. You can also join the mailing list and ask questions there.

Changing the Mod key

The most important modification you may need to make is to assign the Mod key to a different key. The Windows key is often used for this. See this page for an explanation of how to do this if it isn't obvious.

What if I don't have a Windows key?

I don't have this key on my Thinkpad T41 and I thought I was going to have a problem, but there is a simple solution. The Windows key actually generates Super_L, so this is what you use. Choose another key and redefine it to be Super_L, using xmodmap:

xmodmap -e "keycode xxx = Super_L"

To find out what is the key code for your chosen key, use xev.

Having got this working, you can put the above xmodmap command in your ~/.xinitrc file so that it is run automatically when you start X.

Editing your .xinitrc file

Of course, you will lose the normal function of the key you assign as a Windows key, so choose it wisely. The useless and annoying CapsLock key is a good choice; on my computer its key code is 66. You will need an extra line to make it available. There are a couple of other things needed as well, to make the cursor work properly and to set the language, if you don't want US. Here is my ~/.xinitrc file, with comments.

# Next line gives a proper arrow pointer in dwm instead
# of just a cross ('X').
xsetroot -cursor_name left_ptr
# set your keyboard layout for your preferred language.
setxkbmap -layout gb
# Make CapsLock (66) give Super_L (Windows).
/usr/bin/xmodmap -e "clear Lock"
/usr/bin/xmodmap -e "keycode 66 = Super_L"
# The next line starts dwm; it should come last
exec dwm

My config.h