commit bc7a5a728df833ebfde510adff4fb74f29e4d7c9
parent 1b5028d57cee3304b1aa81b9b19502c8e9dfa52d
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 27 Sep 2019 09:56:39 +0200
Merge branch 'master' of src.adamsgaard.dk:src/dotfiles
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/.local/bin/sysstatus b/.local/bin/sysstatus
@@ -28,11 +28,11 @@ printf " $separator"
# cpu
printf " "
-if type sysctl >/dev/null 2>&1; then
+if type sensors >/dev/null 2>&1; then
+ printf "%s " "$(sensors | grep -n 'Core 0:' | awk '{print $3}')"
+elif type sysctl >/dev/null 2>&1; then
printf "%s " "$(sysctl hw.sensors.cpu0.temp0 | \
sed 's/.*=//;s/\.[0-9]* deg/°/')"
-elif type sensors >/dev/null 2>&1; then
- printf "%s " "$(sensors | grep -n 'Core 0:' | awk '{print $3}')"
fi
if [ -f /proc/loadavg ]; then
printf "%s" "$(cut -f 1 -d' ' /proc/loadavg)"
@@ -46,8 +46,7 @@ if type apm >/dev/null 2>&1; then
printf " %s" "$(apm | grep -o -E "[0-9]*%")"
printf "%s" "$(apm | grep -o -E " [0-9]* min")"
printf " $separator"
-elif [ -d "/sys/class/power_supply/$battery" ]; then
- battery=BAT0
+elif [ -d "/sys/class/power_supply/BAT0" ]; then
batstatus=$(sed -n 's/Charging/+/;s/Discharging/-/' \
/sys/class/power_supply/${battery}/status | sed 's/Unknown//')
batlvl=$(cat /sys/class/power_supply/${battery}/capacity)