summaryrefslogtreecommitdiffstats
path: root/.local/bin/b-bar
blob: 8f23563fa3182c460b8374e0b8291561456a5e96 (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
#!/bin/sh
while true
do
    h="$(hostname)"
    vols="$(b-pavols)"
    load="$(cat /proc/loadavg | cut -d' ' -f1)"
    time="$(date +'%a, %d %b %Y %R %z')"

    case $h in
        selene)
            sens="$(sensors -j w83795g-i2c-*-*)"
            nrbr="$(echo $sens | jq -r '.[].temp1.temp1_input')"
            cpu1="$(echo $sens | jq -r '.[].temp7.temp7_input')"
            cpu2="$(echo $sens | jq -r '.[].temp8.temp8_input')"
            printf "%s %s %s | %s | %s | %s\n" \
                   "$nrbr" "$cpu1" "$cpu2" "$vols" "$load" "$time"
            ;;
        *)
            b0="/sys/class/power_supply/BAT0"
            [ "$h" = "anahita" ] && b0="/sys/class/power_supply/sbs-9-000b"
            bat="$(cat $b0/capacity)"
            # batl="$(cat $b0/capacity_level)"
            printf "%s%% | %s | %s | %s\n" \
                   "$bat" "$vols" "$load" "$time"
            ;;
    esac

    sleep 5
done