Post

On Switching to DWM

On Switching to DWM

DWM (the dynamic window manager) is a window manager that is developed with a focus on minimal and efficient code. It is minimal in its small number of lines of code. I’ve used it prior to this, but I decided to run this on my laptop because my battery performance was not the best with i3. The battery life is a lot better with dwm so I will likely continue to use it and to patch my configuration (which can be found here). One thing that sets dwm apart from many window managers is that it lacks a traditional configuration interface. All configuration must be done by directly modifying the source-code, though this is not difficult.

  For the status bar I am using slstatus. Both dwm and slstatus are developed by the suckless team whose approach to software development is to avoid bloat. My slstatus configuration isn’t very complex or crowded. The three elements I incorporated into it are: the SSID of the network I’m connected to, battery percentage, as well as the time in 12-hour format.


  There are a number of additional functions to the status bar which are built-into slstatus such as: remaining battery life, battery charging state, cpu frequency, cpu percentage, free disk space, and many more. Some of these are useful and I might incorporate them into my bar at some point. For now I will keep it simple. The modifications I had to make to the config.h file can be found below.

Startup

  Because I use a login manager (rather than just typing startx at the terminal), I created a script to launch several programs alongside dwm in order to handle things such as wallpaper and compositor. The full startup script can be found here. The script launches picom to use as the compositor, feh to set the background image, slstatus for the status bar, nm-applet to handle connecting to networks automatically, and xautolock as well as xss-lock to handle autolock and sleep. The locker I’m using is betterlockscreen which is a fork of i3lock-colors. In order for this script to be launched automatically by a login manager, the file named dwm.profile must be edited. It is located within the path: /usr/share/xsessions/. The line that needs to be changed is the one starting with “Exec”. Instead of launching dwm directly, the aforementioned script will launch dwm along with other tools.

Patching

  Applying patches to dwm is very straightforward. Patches can be found listed on dwm’s site. By downloading a desired patch into dwm’s source directory and running the command git apply followed by the name of the patch’s .diff file it will be applied. The fullgaps patch listing on dwm’s site

  Once this is done, you must compile dwm again by running sudo make install.

This post is licensed under CC BY 4.0 by the author.