pdwm - A personal fork of dwm

A personal dwm fork with a more practical and visually pleasing setup. It is just a bunch of patches and a few personal changes to the source. My fork.

Brief

Suckless's dwm is a dynamic window manager for Linux. It is one of the most popular window managers on the planet but due to the suckless mentality dwm that comes out of the box is very very minimal. It's reasonable and very functional but very minimal. Thanks to how patches work on dwm software, there's a patch for so many things. The best of the patches can transform dwm into looking like the other window managers. There are patches for the core and the bar too. I have been living inside dwm for almost six months now and have periodically kept updating my fork with the patches and customizing the config. This post is to describe what I have got going inside dwm which I use. I do plan to write a post on window managers in general and how one can use Linux without any desktop environment. When I do my last statement will be changed to lead you to that post.

What have I got?

Let me start by mentioning the forks applied in the order they were applied (there's a how-to apply a patch at the end of this post):

  • systray- This adds the system tray in the right corner of the status bar.
  • autostart- This lets you have a script called ~/.dwm/autostart.sh and dwm runs it everytime it starts.
  • vanitygaps- It's just the eye-candy for windows to have gaps between them in the tile mode
  • hide_vacant_tags- Without this tags that are vacant will be hidden in the status bar.
  • quickswitch- I made the changes in the file dwm.c for this feature. This change lets you switch between two windows next to each other in a tag with Alt+Tab or whatever keybinding you assign the method quick switch inside dwm.c, this change just makes the frequent transition from Windows to Linux and back forth a little more comfortable. I will try to tidy this up and make a patch out of it to submit to suckless.

These are few patches and all the patches I have applied to dwm I use, some more useful patches can be, and most of the patches related to the status bar. It's highly suggested to look at the patches for yourself to get the best out of dwm. Linux encourages customizations and window managers like dwm are highly customizable, therefore you can make it whatever you want, however you want it. These are few patches and all the patches I have applied to dwm I use, some more useful patches can be colorbar, and most of the patches related to the status bar. It's highly suggested to look at the patches for yourself to get the best out of dwm. Linux encourages customizations and window managers like dwm are highly customizable, therefore you can make it whatever you want, however you want it.

Here are some of my scripts for statusbar and the autostart script:

autostart.sh


#! /bin/bash
dunst &
copyq &
xss-lock -v -l xsecurelock &
picom &
nm-applet &
feh --bg-scale /home/law/Downloads/wallpaper.jpg
/home/law/apps/scripts/statusbar.sh &

statusbar.sh


#!/bin/sh

while :
do
    /home/law/apps/scripts/statusbarnoloop.sh
    sleep 60
done

statusbarnoloop.sh


#!/bin/sh

time=$(date "+ %a, %d    %H:%M")
mute=$(pactl list sinks | awk '/Mute:/{ print $2 }' | head -n 1)
bat=$(acpi -b | awk '{ print $4}' | sed 's/%,//')
batStat=$(acpi -b | awk '{ print $3}' | sed 's/,//')

if [ $bat -lt 15 ] && [ $batStat = 'Discharging' ]
then
    notify-send 'Battery Low!' "Plug in the charger."

elif ( [ $bat = 30 ] || [ $bat = 25 ] ) && [ $batStat = 'Discharging' ]
then
    notify-send 'Battery Low!' "Plug in the charger."

elif ( [ $bat = 90 ] || [ $bat = 85 ] ) && [ $batStat = 'Charging' ]
then
    notify-send 'Charged!' "Remove the charger."

elif [ $bat -gt 95 ] && [ $batStat = 'Charging' ]
then
    notify-send 'Charged!' "Remove the charger."

fi

if [ $batStat = 'Charging' ]
then
    bat=$bat" "
else
    bat=$bat" "
fi

volume=$(amixer -c 1 -M -D pulse get Master | grep -o -E [[:digit:]]+% | awk "FNR  /home/law/apps/scripts/temp
fi

temp=$(cat /home/law/apps/scripts/temp)

if [[ $mute = "yes" ]]
then
    xsetroot -name "    $bat    $temp   婢 mute    $time   "
else
    xsetroot -name "    $bat    $temp   墳 $volume    $time   "
fi

How to apply patches

To apply a patch you may try the following command inside the project directory (in our case dwm):


patch < NAME_OF_THE_DIFF_FILE 

Did it fail for you?

The thing with patching is that it rarely succeeds on its own. Patches come with a .diff extension which is a file containing the location of the code which needs to change and what to replace the code with. If you have modified these files before or more specifically the lines which need to change through the patch, the patch will fail. The typical way to apply a patch is not so bad but the user has to manually look in the diff and change the code. It’s not all that bad but it is what it is.


So that's pretty much it, that's all I have on my fork of dwm and the fork is available on my GitHub. This is not the only window manager I have been on, I have tried all the major ones but feel that dwm is the simplest and most extensible of all. I am not a fan of the suckless mentality but you should try dwm, it's a great window manager.



Thank you for making it this far in the post. Have a great day ahead!