#!/bin/sh green="#B7CE42" grey="#666666" white="#dddddd" dblue="#1874cd" blue="#6F99B4" yellow="#FEA63C" red="#D81860" cyan="#A7A15E" LviOlet="#9979A9" DviOlet="#ff007e" WviOlet="#bc81ea" mpd(){ mpd="$(mpc | grep - | cut -c1-30)" echo "^s[right;$DviOlet;$mpd ]" } bat(){ bat="$(acpi -V | awk '{ gsub(/,/, "");} NR==1 {print $4}')" echo "^s[right;$LviOlet;bat: ]^s[right;$DviOlet;$bat ]" } cpu(){ cpu="$(eval $(awk '/^cpu0 /{print "previdle=" $5 "; prevtotal=" $2+$3+$4+$5 }' /proc/stat); sleep 0.4; eval $(awk '/^cpu0 /{print "idle=" $5 "; total=" $2+$3+$4+$5 }' /proc/stat); intervaltotal=$((total-${prevtotal:-0})); echo "$((100*( (intervaltotal) - ($idle-${previdle:-0}) ) / (intervaltotal) ))")" echo "^s[right;$LviOlet;cpu0: ]^s[right;$DviOlet;$cpu% ]" } cpu1(){ cpu="$(eval $(awk '/^cpu1 /{print "previdle=" $5 "; prevtotal=" $2+$3+$4+$5 }' /proc/stat); sleep 0.4; eval $(awk '/^cpu1 /{print "idle=" $5 "; total=" $2+$3+$4+$5 }' /proc/stat); intervaltotal=$((total-${prevtotal:-0})); echo "$((100*( (intervaltotal) - ($idle-${previdle:-0}) ) / (intervaltotal) ))")" echo "^s[right;$LviOlet;cpu1: ]^s[right;$DviOlet;$cpu% ]" } mem(){ mem="$(free -m | grep "buffers/" | awk {'print $3'})" echo "^s[right;$LviOlet;mem: ]^s[right;$DviOlet;$mem ]" } dte(){ dte="$(date +"%a %d %b %Y")" echo "^s[right;$WviOlet;$dte ]" } tme(){ tme="$(date +"%H:%M:%S")" echo "^s[right;$white;$tme;$clear ]" } TIMING=2 statustext(){ wmfs -c status "leftbar $(mpd) $(cpu) $(cpu1) $(mem) $(bat) $(dte) $(tme)" } while true; do statustext sleep $TIMING done