summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-03-05 15:18:55 +1300
committerDavid Phillips <david@sighup.nz>2017-03-05 15:18:55 +1300
commitae6f0dafc270e6716d56d7dfed3f8aa6d8c72cc5 (patch)
treecaace9a4fcf24461ff85226e4f2ab0748c4de70d
parent4ee14fed1c0070b2bb4f534c24a56f00e2aa21ea (diff)
downloaddotfiles-ae6f0dafc270e6716d56d7dfed3f8aa6d8c72cc5.tar.xz
Fix indentation on battery status line, add XAG spot to dwm status
-rwxr-xr-xlocal/bin/update-dwm-bar45
1 files changed, 28 insertions, 17 deletions
diff --git a/local/bin/update-dwm-bar b/local/bin/update-dwm-bar
index ff3a389..34a283f 100755
--- a/local/bin/update-dwm-bar
+++ b/local/bin/update-dwm-bar
@@ -4,24 +4,35 @@ DELAY=20
sep=$(echo -e '\u2502')
while true; do
- bat="$(cat /sys/class/power_supply/BAT0/capacity)%"
- case "$(cat /sys/class/power_supply/BAT0/status)" in
- Full)
- bat_icon='✓'
- ;;
- Charging)
- bat_icon='▲'
- ;;
- Discharging)
- bat_icon='▼'
- ;;
- *)
- bat_icon="(?)"
- ;;
- esac
- bat_string="$bat_icon $bat"
+ if [ -f ~/.cache/XAGNZD ]; then
+ xag="$(cat ~/.cache/XAGNZD) $sep"
+ fi
+ if [ -d /sys/class/power_suppply/BAT0/ ]; then
+ bat="$(cat /sys/class/power_supply/BAT0/capacity)%"
+ case "$(cat /sys/class/power_supply/BAT0/status)" in
+ Full)
+ bat_icon='✓'
+ ;;
+ Charging)
+ bat_icon='▲'
+ ;;
+ Discharging)
+ bat_icon='▼'
+ ;;
+ *)
+ bat_icon="(?)"
+ ;;
+ esac
+ bat_string="$bat_icon $bat $sep "
+ fi
+ thermal_string="🌡"
+ for zone in /sys/class/thermal/thermal_zone* ; do
+ temp="$(cat $zone/temp)"
+ thermal_string="$thermal_string $(($temp / 1000)),"
+ done
+ thermal_string="${thermal_string%,} °C"
datetime_string=$(date "+%A $sep %d %h %Y $sep %_I:%M %p (UTC%:::z)")
- xsetroot -name "$(uname -r) $sep $bat_string $sep $datetime_string" || exit
+ xsetroot -name "$xag $thermal_string $sep $bat_string$datetime_string" || exit
sleep "$DELAY"
done