From e4bf2d9d637a64e83b1050f5bc8bcf86164d680b Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Fri, 1 Feb 2019 17:31:23 -0600 Subject: [PATCH] updating dwm status bar information. --- .dwm/autostart.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.dwm/autostart.sh b/.dwm/autostart.sh index 99ae235..4d74489 100755 --- a/.dwm/autostart.sh +++ b/.dwm/autostart.sh @@ -3,7 +3,32 @@ compton --config ~/.config/compton/compton.conf & nitrogen --restore & urxvtd -q -o -f & +dte(){ + dte="$(date +"%A, %B %d - %H:%M")" + echo -e "🕒 $dte" +} + +upd(){ + upd=`checkupdates | wc -l` + echo -e "⟳ $upd updates" +} + +mem(){ + mem=`free | awk '/Mem/ {printf "%d MiB/%d MiB\n", $3 / 1024.0, $2 / 1024.0 }'` + echo -e "🖪 $mem" +} + +cpu(){ + read cpu a b c previdle rest < /proc/stat + prevtotal=$((a+b+c+previdle)) + sleep 0.5 + read cpu a b c idle rest < /proc/stat + total=$((a+b+c+idle)) + cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + echo -e "💻 $cpu% cpu" +} + while true; do - xsetroot -name "` date +"%b %e, %Y - %R" `" - sleep 1m # Update time every minute + xsetroot -name "$(cpu) | $(mem) | $(upd) | $(dte)" + sleep 10s # Update time every ten seconds done &