dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone git://edryd.org/dotfiles
Log | Files | Refs

commit 4b7b01c5125b07df20abc893f41fd0adb8f17d5a
parent b5bb6f29fa53ce23391a668f46bf8729c68fb33d
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Sun, 19 Feb 2017 16:39:09 -0800

dwmstatus: Clean up and add music, cpu, weather

Remove sound and battery which are in my system tray

Diffstat:
bin/dwmstatus.sh | 45++++++++++-----------------------------------
1 file changed, 10 insertions(+), 35 deletions(-)

diff --git a/bin/dwmstatus.sh b/bin/dwmstatus.sh @@ -9,44 +9,19 @@ while true; do sleep 1 done < ~/.msg else - # batperc=$(upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep "percentage" | cut -c26-27) - # batstate=$(upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep "state" | awk '{print $2}') + song=$(basename "$(cmus-remote -Q | grep file | cut -d ' ' -f 2-)" .mp3) ramused=$(free -m | grep Mem | awk '{print $3}') ramtotal=$(free -m | grep Mem | awk '{print $2}') - # soundperc=$(amixer get Master | tail -n1 | awk '{ print $5 }' | tr -d []%) + cpuperc=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}') + temp=$(curl -s wttr.in | head -4 | tail -1 | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | rev | sed -e 's/^[ \t]*//' | cut -d " " -f 1,2 | rev | tr -d " ") - # if [[ $soundperc -le 10 ]]; then - # status+="" - # elif [[ $soundperc -le 33 ]]; then - # status+="" - # elif [[ $soundperc -le 66 ]]; then - # status+="" - # else - # status+="" - # fi - - status+="$(echo "$ramused"*100/"$ramtotal" | bc)%" - - # if [[ $(upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep "native-path" | awk '{print $2}') != "(null)" ]]; then - # if [[ $batstate = "charging" ]]; then - # if [[ $batperc -eq 99 ]]; then - # status+="" - # else - # status+="" - # fi - # elif [[ $batperc -le 10 ]]; then - # status+="" - # elif [[ $batperc -le 25 ]]; then - # status+="" - # elif [[ $batperc -le 50 ]]; then - # status+="" - # else - # status+="" - # fi - # status+="$batperc%" - # fi - - status+="$(date +"%b %d %I:%M")" + if [[ $(cmus-remote -Q | grep status) == "status playing" ]]; then + status+="$song" + fi + status+="$cpuperc" + status+="$(echo "$ramused"*100/"$ramtotal" | bc)%" + status+="$temp" + status+="$(date +"%b %d %I:%M")" xsetroot -name "$(echo -e "$status")" sleep 1