From f1556103c6f7d0ce68fafb72ab9c18703539b770 Mon Sep 17 00:00:00 2001 From: jon Date: Sat, 23 Feb 2019 14:37:45 -0600 Subject: [PATCH] Cleanup and comments --- jstat | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jstat b/jstat index e741300..3185968 100755 --- a/jstat +++ b/jstat @@ -4,18 +4,27 @@ xsetroot -name "Loading ..." while (true); do #set date: 04.03 15:22 + timedate=$(date +"%m.%d %H:%M") + + ## memory in use #mem=$(free -m | grep Mem | awk '{print $7}') + + ## load average #loadavg=$(cat /proc/loadavg | awk '{print $1 " " $2 " " $3}') - #xsetroot -name "$mem | $loadavg | $timedate" + + # check if mpd is playing + # if yes, output volume and song check_play=$(mpc status | grep "playing") if [ ! -z "$check_play" ]; then - play=$(mpc status | head -n 1) + play="$(mpc status | head -n 1) |" vol="[$(mpc vol | cut -c 8-)]" else + #otherwise hide it vol="" play="" fi - timedate=$(date +"%m.%d %H:%M") - xsetroot -name "$vol $play | $timedate" + + # final output to status bar + xsetroot -name "$vol $play $timedate" sleep 0.5; done