Puffy Meets Suckless
OpenBSD and dwm go together like coffee and cigarettes. One of the best things about OpenBSD is Xenocara, their patched version of X11 that comes in the base install.
Preparation
First, make sure you have the xbase and xcomp sets installed. If you did a
default install, you already have them. We’ll also need git to grab the source and
doas for privileges. If you haven't configured doas yet, add your user to
/etc/doas.conf:
permit persist :wheel
Then install git:
doas pkg_add git
Getting the Source
Don't use the version in pkg_add. The whole point of a suckless tool is to edit the source
code. Clone it into a local directory:
git clone https://git.suckless.org/dwm cd dwm
Fixing the Paths
By default, dwm looks for X11 headers in /usr/X11R6/include and libraries in
/usr/X11R6/lib. OpenBSD puts them exactly there, but many Linux-centric Makefiles expect
them in /usr/include. Open config.mk and ensure the following lines match the
OpenBSD paths:
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
FREETYPEINC = /usr/X11R6/include/freetype2
Also, since OpenBSD doesn't use the same LDFLAGS as Linux, you might need to add
-lkvm to your libraries if you use certain status bar patches.
Compile and Install dwm
Now, build the binary. We use make (OpenBSD's make works fine here):
make doas make install
Compile and install dmenu
git clone https://git.suckless.org/dmenu
cd dmenu
# Edit config.mk to point to /usr/X11R6/ like before
make
doas make install
Notes
By default, dwm looks for st. If you prefer xterm (which comes with OpenBSD),
you'll need to edit config.def.h in your dwm source directory, change the
termcmd variable, and recompile. Personally, I would just use xterm.
One very important thing: make only uses config.def.h to
create config.h the first time. If config.h already exists
because you might've already compiled dwm, changes to .def.h won't apply unless you delete
config.h or edit both to be the same.
Starting the Session
OpenBSD handles graphical logins via xenodm. Whether you use xenodm or
startx, you need an .xsession file in your home directory. Create it and make
sure it ends with the call to dwm:
# Set your wallpaper or status bar here
# xsetroot -name "puffy rules" &
exec dwm
Crucial: Your .xsession file must be executable, or xenodm will just kick
you back to the login screen.
chmod +x ~/.xsession
Why no SLiM or GDM?
You can install other display managers, but xenodm is part of the base system, it’s secure, and it’s very
minimalist. If you're going for a suckless setup, using the tools the OpenBSD devs gave you is usually
the most stable path. If you want to customize the look of xenodm, the files are in
/etc/X11/xenodm/.
Reboot, or just rcctl enable xenodm && rcctl start xenodm. If everything went well,
you're now staring at a very blank, very secure screen.