I’ve been using DWM for a couple of weeks now, and after a couple of patches I’ve settled upon a setup that suits me. When i first started using DWM i was manually patching a cloned git branch…it worked, but it wasn’t clean. I’ve since moved to a much cleaner git setup if your interested in doing the same here are the steps i used.

First lets clone the DWM repository in our working directory

cd ~/.git/
git clone https://git.suckless.org/dwm
cd dwm

Creating our first branch

Now we’ve cloned the main branch, we can create our first branch and apply our first tweaks/patches.

git branch scratchpad
git checkout scratchpad

we can call this branch anything we like, here I’ve called it scratchpad. For this example I’ll use the dwm scratchpad patch to modify our branch. First download the diff file from the suckless website

patch -p1 < ~/Downloads/dwm-scratchpad*.diff

then commit our changed to this branch

git commit

this will merge these changes just to our current branch. You can check this by swapping to the master branch and checking the files for the modifications

git checkout master
cat config.def.g | grep scratchpad

The output from this should be nothing, as the original dwm config.def.h doesn’t contain a scratchpad reference. Then rinse and repeat for as many branches as needed, e.g.

git branch my-tweaks
git checkout my-tweaks
vim config.def.h
...
#define MODKEY Mod4Mask
...
git commit

Once we have created all our modifications and patches as separate branches we need to merge them into a new branch.

git branch merged
git checkout merged
git merge scratchpad
git merge my-tweaks
git commit

If all of these commands are successful your current merged branch should contain all of the patches and tweaks merged. If your patches/tweaks conflict you can manually edit the respective file following the git errors for guidance.

Now its time to build and checkout our work

rm -Rf config.h
make clean all
sudo make install

Provided there are no errors, we can now run our modified DWM by logging out and logging back in (Provided your xinit is set to exec dwm).

You can see my dwm tweaks on my GitHub under the merged branch. If i continue using this desktop setup for a few more weeks I’ll probably write a review of dwm, and detail my final setup.