A dwm (Dynamic Window Manager) Journey- 2

As I noted in my first article in this series, I began this journey with a decent understanding of both bspwm and herbstluftwm (hlwm). However, if I wanted to use dwm, I needed to learn more about suckless’ software, especially dwm.

Where was a person to begin??

The obvious starting point seemed to be the suckless website. However, on my first visit I was shocked; it looked like their material was pretty well “above my pay grade.” I thought I needed something just “a tad” less user hostile.

Where was the Dummy’s Guide?

I found several helpful sources (including something from suckless):

After having reviewed the above pages, it was clear that I needed some practice and more advanced learning.  Getting practice was easy enough, I thought.  I just need to install dwm.  The problem was dwm isn’t really standard; it requires a compile if you want to do it ‘right’ or so, my friends on the arch wiki tell me.

Here is “one way to do it right.”

Start by loading the following dependencies.

In arch:

# sudo pacman -S xorg xorg-xinit

In Debian:

# sudo apt install make gcc libx11-dev libxft-dev libxinerama-dev xorg

Next be certain you have the following installed.  If you don’t you will need to install them.

  • make
  • wget
  • tar

Then in your terminal enter the following wget command to download dwm:

# wget https://dl.suckless.org/dwm/dwm-6.2.tar.gz

Decompress the downloaded tar file using tar in terminal (or if you prefer you may use your file manager).

#tar -xzvf dwm-6.2.tar.gz

Next change into your dwm directory (you may wish to create the directory in .local/bin first, which is what I recommend) and then install dwm via terminal using the following.

# sudo make clean install

Another major challenge for me was in finding a good cheat-sheet to help me modify suckless software using patches. You’ll need to modify (patch) suckless software if you want to use (incorporate) suckless patches in your setup. Think of these patches as suckless plugins. I only use a single patch (I want to keep my dwm install pretty minimal; because I can.) The single patch I use creates a system tray (systray) in dmenu.

Here is a decent guide on patching dwm. […]How to add patches to dwm […]

I have excerpted a big chunk below:

Suckless.org provides instructions on applying patches to DWM, and the procedure is pretty simple. I’ll add a few more details […] I’m assuming that you’re building dwm from source, since you’ll need to do this in order to install patches.

  • Save the patch somewhere in your source directory, and run ‘git apply pertag.diff”
  • If the patch added any new files, run ‘git add <name of new file>’ to add them to the repository. If no new files were added, ignore that. Once you’ve added any new files, run ‘ git commit -a’ to commit the changes.
  • Rebuild dwm. If you’re building dwm as root, run ‘make clean install’ from the top folder of dwm’s source tree (e.g., if you downloaded the source into ‘/build/dwm’, run the command in that folder). It’s the folder with the makefile. If you are building/installing dwm as a non-root user, just run ‘make’ from the source folder.
  • If you already have your system set up to use dwm, either through
    installing it as root or building it as a normal user and pointing to
    your user’s copy, you shouldn’t have to redo any configuration. Just
    restart dwm and the patch should be working.

Once you have successfully compiled dwm, it is ready to be setup for execution.  If you want to have dwm appear as an option on LightDM and start it via LightDM, you will have another small task to perform:

Create an xsession file for dwm. To do this you can create a dwm.desktop file and then save it.

  • In a terminal window enter:

# sudo geany /usr/share/xsessions/dwm.desktop

Make certain  <UserName> below = your username.

[Desktop Entry] Name=dwm
Comment=dynamic window manager
Exec= /home/<UserName>/.local/bin/autostart-scripts/start-dwm.sh
Type=Application
Icon=preferences-system-windows-move

Next, create the following directory  ~/.local/bin/autostart-scripts

First open an editor:

# geany start-dwm.sh

Then, you will need to edit and copy the following content; save the file to: ~/.local/bin/autostart-scripts (This will act as a start script for LightDM.).

Note: If you have not installed dunst, slstatus, conky, or lxsession/lxpolkit then disable or remove the corresponding lines in the script (below).

#! /bin/sh
#
# dwm autostart, etc.
#
# slstatus
slstatus &
# dunst
dunst -conf ~/.config/dunst/dunstrc &
# conky
conky -c ~/.conky/<UserName>/.dwmconkyrc &
# policy kit
lxpolkit &
#start dwm
exec dwm

If you find this material helpful or useful, please consider supporting us on Patreon or by purchasing Linux Bling from our online stores. We even offer dwm & suckless items!

Remember, like with all of my work, I am able to provide the following assurance(s):
  • It is almost certainly going to work until it breaks; although I have to admit it may never work and that would be sad.
  • When/if it does break, you may keep all of the pieces.
  • If you find my materials helpful, both you & I will be happy, at least for a little while.
  • My advice is worth every penny you paid for it!