status monitor

The status bar text of dwm is stored in the WM_NAME X11 property of the root window, which is managed by dwm.

It can be easily set and retrieved using standard Unix tools.

xsetroot -name $status

xprop -root -notype -f WM_NAME "8u" \
    | sed -n -r 's/WM_NAME = \"(.*)\"/\1/p'

Example shell scripts

Return battery capacity percentage:

$(echo $(awk '/rem/ { print $3/89000 }' /proc/acpi/battery/BAT0/state| hoc| cut -c3,4)%

Your battery may be called something different, so check /proc/acpi for its name. Also, change 89000 to whatever the capacity is for your battery. This returns the remaining battery power as a percentage. hoc comes from plan9port or 9base.

Depending on your system, you can also use

cat /sys/class/power_supply/BAT0/capacity

to get your battery status in percentage.

Return the amount of ram used, in megabytes:

$(free -m |awk '/cache:/ { print $3"M" }')

Return the temperature of the cpu, in degree celcius:

$(awk '{ print $2 }' /proc/acpi/thermal_zone/THM0/temperature)C

Return volume:

amixer get Front | tail -n1 | awk '{ print $5 }' | tr -d []

Change “Front” to your audio device

Using shell scripts very well leads to big scripts, which pull in unneeded dependencies. One solution for this is to write everything in C, which is much more efficient.

slstatus - suckless status

General purpose status monitor for dwm and other window managers for Linux and OpenBSD written in C for maxium efficiency.

You can read more on the project page.


Barebone status monitor with basic functions written in C. It can be used instead of slstatus if only very basic functions are needed. Extension is possible too using code from below.

You can read more on r-36.

User submitted versions

Feel free to add your own status monitors here (keeping the list sorted).

Helper functions

If you have simple C functions for gathering system information, feel free to add them here (keeping the list sorted).