aaronrogier.net

My Online Note and Recipe Collection

Early dwm Enhancements

August 10, 2025 Anno Domini

Let us continue from the previous episode

Let us begin from the home directory with an initial dwm, dmenu, and st already built.

~$ cd suckless
~/suckless$ cd dwm
~/suckless/dwm$ ls
LICENSE  Makefile  README  config.def.h  config.h  config.mk  
drw.c  drw.h  drw.o  dwm  dwm.1  dwm.c  dwm.o  dwm.png  
transient.c  util.c  util.h  util.o

Now we see two files that need our attention, config.def.h and config.h. When we make our dwm, the config.def.h is copied with the name config.h. This means that for changes we make to our config.def.h to be applied, we need to first delete the existing config.h:

~/suckless/dwm$ rm config.h

You may now open `config.def.h in an editor of your choice.

One of the most accessible and highest impact changes we can make is to the colors of our dwm environment. You can use a web color picker tool to get hex codes for colors you will like to use.

Here is an example stanza which preserves the original color variable names. The colors were chosen to be complimentary and take advantage of the reality of color screens in the big 2025:

/* appearance */
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const int showbar            = 1;        /* 0 means no bar */
static const int topbar             = 1;        /* 0 means bottom bar */
static const char *fonts[]          = { "monospace:size=11" };
static const char dmenufont[]       = "monospace:size=11";
static const char col_gray1[]       = "#001100";
static const char col_gray2[]       = "#444444";
static const char col_gray3[]       = "#00dd00";
static const char col_gray4[]       = "#eeeeee";
static const char col_cyan[]        = "#6611ff";
static const char *colors[][3]      = {
	/*               fg         bg         border   */
	[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
	[SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
};

In practice, this looks like:

Screenshot of Diy Desktop Environment

As you can see, the interfaces bend together well to keep the working area of the the screen a subject of focus while remaining informative and present.

Check out [the official dwm patches collection] for further study material.

When hacking away at config.def.h, we enter a loop of:

~/suckless/dwm$ rm config.h
~/suckless/dwm$ doas make clean install

To use our new build of dwm, we need to begin a new session. The fastest way to do this is by killing your current X11 session with Modifier+Shift+Q, then spawning a new X11 session with startx like:

~$ startx

This is necessary because the new binary does not replace the binary that was already running. Since dwm is our window manager, it coordinates the rest of our X11 sessions thusly, restarting it can be especially disruptive as all of the open windows will terminate with our window manager.