Installing suckless's Dwm - How it works and how to install my build.

I've recently started getting into Dwm (Dynamic window manager.) It has definetly earned a spot as one of my favorite WMs. Here's how to install it and get my build of it.

Dwm is a Tilling window manager by the Suckless group. It is known to be super fast and small to the point where it doesn't have a normal config file. To configure it you change the source code and compile it. I think that this is a great idea in terms of space and how much bloat there is but it's a double edged sword; It will take more time to see the changes as you will have to recompile dwm everytime you make a change.

Fortunately, I made a build that everyone can use! Lets install it.

First we will head over to Codeberg (a Gitea instance) and download the code.

My repo is here. Let's clone it:

$ git clone https://codeberg.org/connor/dwm-config.git

Then we will make it (unless you want to change anything in config.h:

cd dwm-config
sudo make install

Unless there are any errors (you can ignore the warnings) then dwm is good to go!

Well, almost. You will still need to configure some stuff like the bar and the background.

Note: If you use a display manager like GDM, you will need to make a file for dwm to have it appear on the DM.

paste this into /usr/share/xsessions/dwm.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=the dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession

According to the Dwm tutorial page, You should put all your "on startup" commands in your ~/.xinitrc. I don't like doing that, because there are dwm specific thing that I don't want running on another wm so I got the autostart patch. If you make a script at ~/.dwm/autostart.sh, dwm will run it for you on every startup of dwm.

Lets start the writing the script.

The first thing I put was my background restore command. If you use feh, that would be sh ~/.fehbg. If you use Nitrogen, that would be nitrogen --restore.

Then you can put the titlebar script. By default the bar at the top only says dwm X-x. That isn't very usefull, and you will definitely need a script to show information like how much battery you have. I decided to use Conky because it's pretty easy to use rather than making your own script.

Download Conky form your Distro's package manager then make the conky config file (.config/conky/conky.conf). Here is mine:

conky.config = {
out_to_console = true,
out_to_x = false,
background = false,
update_interval = 2,
total_run_times = 'none',
};
conky.text = [[
$mpd_smart :: battery: ${battery_percent}% :: cpu: ${cpu cpu1}% / ${cpu cpu2}%  ${loadavg 1} ${loadavg 2 3} :: ${acpitemp}c :: $memperc% ($mem) :: ${time %a %b %d %I:%M%P}
]];

Make sure when you are making your conky config that you make it out to the console because it will all just be piped to the bar.

You succesfully get conky working, put this into the autostart script:

(conky | while read LINE; do xsetroot -name "$LINE"; done) &

Make sure you put that at the bottom of the script because it won't stop looping.

No that we are done with the script, save it and make it executable (chmod +x), log out and start up dwm.

You should now have a fully functioning dwm desktop. You can look at config.h from the source code for the keybindings.