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'
Set The Status Using A Shell Script
while true; do
xsetroot -name "$(date)"
sleep 2
done
Set The Status Using Other Methods
There are two status monitors maintained at suckless:
slstatus - suckless status
A somewhat complex status monitor which includes all batteries.
You can read more on the project page.
dwmstatus
Barebone status monitor with basic functions written in C. This follows the suckless philosophy, to give you an easy way to extend the source code to your needs. See the helper functions for C below, to extend it to your needs. Just check it out and keep on hacking.
git clone git://git.suckless.org/dwmstatus
cd dwmstatus
make
make PREFIX=/usr install
# add »dwmstatus 2>&1 >/dev/null &« to your .xinitrc
Status Monitors Submitted By Others
Feel free to add your own status monitors here (keeping the list sorted).
- barM - can display all, time/date, ram usage, output of commands (the New BarMonitor).
- dstat Screenshot - displays the current network throughput, CPU usage, performance settings, battery status, temperature, volume settings, as well as the current date and time (OpenBSD only, no support for Linux).
- dwms - displays time, network, audio, and battery status, written in Go using XGB.
- dwmsd - a daemon that listens on localhost tcp (may be useful as a base for asynchronous updates)
- dwm-sss - shell script providing date, time and CPU temperature
- dwmstat - small and simple | IP, CPU temperature, system volume, current local time (and more) | config.h | OpenBSD
- go-dwmstatus - A Go bar that prints current MPD song, load averages, time/date and battery percentage.
- gods - implemented in Go. prints network speed, cpu, ram, date/time
- profil-dwmstatus-1.0.c - cpufreq, battery percent and date/time
- suspend-statusbar.c - date, loadavg, battery and more. If battery goes below threshold - run suspend command
Helper Functions In The Shell
- posix scripts - basic collection of simple, fully POSIX sh compliant scripts to get various system information
- i3blocks-contrib - collection of python, perl and shell scripts
- Free memory:
free -h | awk '(NR==2){ print $3 }' - Volume (device Master):
amixer get Master | awk -F'[][]' 'END{ print $4":"$2 }' - Keyboard layout:
setxkbmap -query | awk '/layout/{ print $2 }' - Empty disk space (mountpoint /home):
df -h | awk '{ if ($6 == "/home") print $4 }' - wifi status (interface wlp3s0):
cat /sys/class/net/wlp3s0/opestate - CPU temperature:
sed 's/000$/°C/' /sys/class/thermal/thermal_zone0/temp. Alternatively you can useacpi -torsensorsfrom lm-sensors package. For older systems you can get the cpu temperature from/proc/acpi/thermal_zone/THM0/temperature - Remaining battery:
cat /sys/class/power_supply/BAT0/capacity. Alternatively you can useacpi -b. For older systems you can get the battery capacity from/proc/acpi/battery/BAT0/state.
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.
Helper Functions In C (for dwmstatus or slstatus etc.)
If you have simple C functions for gathering system information, feel free to add them here (keeping the list sorted).
- ACPI battery status on Linux
- Battery on Linux: Battery percentage and status. + if charging, - if discharging, = if full.
- Detecting Man-In-The-Middle
- Disk usage and execute some check at different moments
- FIFO info: Replaces dynamic_info.
- Line per line the content of a file: See tmpinfo function. It prints line after line the content of /tmp/dwmbuf.
- MPD title/artist
- Number of new mails in a Maildir
- Temperature from /sys on Linux
- Uptime
- Up-, and downspeeds of all network interfaces from /proc/net on Linux
- Volume via ALSA API