Add dwm window manager in Ubuntu


Install tools and dependencies.
$ sudo apt install suckless-tools acpi gcc make git conky-cli xfonts-terminus libxft-dev build-essential libx11-dev libxinerama-dev sharutils

Clone dwm github repo.
$ git clone https://git.suckless.org/dwm

Create config.h file in dwm folder. Example config here.

To change from focus window "onmouseover" to focus on click, download the latest patch from: https://dwm.suckless.org/patches/focusonclick/ and apply it.
$ patch dwm.c (filename).diff

Compile dwm.
$ sudo make install

Create start script for dwm.
/usr/bin/dwmstart:
#!/bin/bash
xscreensaver -no-splash &
(conky | while read LINE; do xsetroot -name "$LINE"; done) &
exec dwm

Make the script executable.
$ sudo chmod +x /usr/bin/dwmstart

Create lightdm desktop file.
/usr/share/xsessions/dwm.desktop:
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwmstart
Icon=dwm
Type=XSession

Create conky config.
~/.conkyrc:
background no
out_to_console yes
out_to_x no
update_interval 2
total_run_times 0
use_spacer 9

TEXT

CPU: ${cpu cpu0}% ${execi 2 acpi -t | cut -d' ' -f4}C | RAM: $memperc% ($mem) | DISK: used: ${execi 2 df -h | grep '/dev/' |head -n 1|tr -s ' '|cut -d ' ' -f 5} free: ${execi 2 df -h | grep '/dev/' |head -n 1|tr -s ' '|cut -d ' ' -f 4 } | WIFI: ${execi 2 echo "scale=2;`cat /proc/net/wireless | tail -n 1 | cut -d' ' -f5,6 | sed -e 's/^[[:space:]]*//' -e 's/[[:punct:]]*$//'`/70*100" | bc | cut -d '.' -f1}% | Batt:${execi 20 acpi -b | sed 's/.*,\(.*\)%.*/\1/'}% ${execi 20 acpi -b | sed -n 's/.*\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9].*/\1/p'} h | ${time %a %b %d %H:%M}

Optional

Add background picture and trayer with nm-applet to right bottom corner. Additional icons for programs with tray icons will also show here.
Append to ~/.profile:
#Set bg pic
feh --bg-scale /path/to/picture.jpg

#Start trayer and nm-applet
(sleep 5 && trayer --expand true --widthtype request --transparent true --alpha 255 --edge bottom --align right && nm-applet) &



<< BACK