blob: 04ae6bb7adb8094ea45954bea7322d317cb16a72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
while true
do
host="$(hostname)"
vols="$(b-pavols)"
load="$(cat /proc/loadavg | cut -d' ' -f1)"
date="$(date +'%a, %d %b %Y %R %z')"
bar="$vols | $load | $date"
case $host in
selene)
sens="$(sensors -j w83795g-i2c-*-*)"
cpu1="$(echo $sens | jq -r '.[].temp7.temp7_input')"
cpu2="$(echo $sens | jq -r '.[].temp8.temp8_input')"
# KGPE-D16 northbridge temperature
nrbr="$(echo $sens | jq -r '.[].temp1.temp1_input')"
bar="$cpu1 $cpu2 $nrbr | $bar"
;;
adelita|anahita)
if [ -x "$(command -v emacsclient)" ]; then
embat='(battery-format b/battery-format (funcall battery-status-function))'
bat="$(emacsclient -e "$embat")"
bat="${bat%\"}"
bat="${bat#\"}"
else
[ "$host" = "anahita" ] && bdev="sbs_9_000b" || bdev="BAT0"
b0="$(upower -i /org/freedesktop/UPower/devices/battery_$bdev)"
batstat="$(echo "$b0" | awk '/state/{print $NF}')"
if [ "$batstat" = "discharging" ]; then
batstat='-'
elif [ "$batstat" = "charging" ]; then
batstat='+'
fi
batcap="$(echo "$b0" | awk '/percentage/ \
{sub(/\%$/, "", $NF); \
print $NF}')"
battime="$(echo "$b0" | awk -F: '/time to (full|empty)/ \
{sub(/^[ \t]+/, "", $NF); \
sub(/\ hours?$/, "h", $NF); \
print $NF}')"
bat="${batcap}$batstat $battime"
fi
bar="$bat | $bar"
;;
*)
;;
esac
printf '%s\n' "$bar"
sleep 5
done
|