DWM - How to apply patches

archlinux screenshot using dwm - display window manager

By default, the suckless software comes with the minimum required to work, but you can extend it with patches made by the community.


Dependencies

$ sudo pacman -S patch curl

Find and download patches

1 - Finding

patches can be found on:


2 - Downloading

# Example!
$ curl https://dwm.suckless.org/patches/tilegap/dwm-tilegap-6.4.diff >> dwm-tilegap-6.4.diff
$ curl https://raw.githubusercontent.com/bakkeby/patches/master/dwm/dwm-autostart-6.3.diff >> dwm-autostart-6.3.diff

How to apply patches

To apply a patch, you need to have the repository of the software. Then, you patch it using the .diff file and rebuild!

$ rm ./dwm/config.h # <- recommended; some patches change the default configs.
$ patch -d ./dwm < dwm_patch.diff
$ sudo make -C ./dwm clean install

Optional: Using a Script

Alternatively, you can use a script to patch everything quickly.

# You can use this script to patch st or dmenu too :)

DIR="./dwm" # <- path to the suckless software
PATCHES=(
  # The raw link of the patches files
  # "https://dwm.suckless.org/patches/tilegap/dwm-tilegap-6.4.diff"
)

rm -f ${DIR}/config.h

for value in ${PATCHES[@]}; do
  curl -q ${value} | patch -d ${DIR} -i -
done

sudo make -C ${DIR} clean install