#!/bin/sh printmail() { cd ~/mail for i in *; do if [ -d $i/new ]; then n=`ls $i/new/ | wc -l` if [[ $n > 0 ]]; then echo -n "$i=$n, " fi fi done } printbat() { full=$(grep "full capacity" /proc/acpi/battery/C1B5/info | tr -s ' ' |cut -d' ' -f4) current=$(grep "remaining capacity" /proc/acpi/battery/C1B5/state | tr -s ' ' |cut -d' ' -f3) echo "$current*100/$full" | bc | sed 's/$//' } while true do echo "`printmail` `date '+%Y-%m-%d %H:%M'` `uptime | sed 's/.*,//'` `printbat`" > ~/.dwm-status sleep 30 done