summaryrefslogtreecommitdiffstats
path: root/.local/bin/my-bar
blob: 0f8e28338de863cd5aabd81b5759718e0e720a1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
while true
do
    b0="/sys/class/power_supply/BAT0"
    bat="$(cat $b0/capacity)"
    # batl="$(cat $b0/capacity_level)"
    sinkv="$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '\d+(?=%)' | head -n1)"
    sinkm="$(pactl get-sink-mute @DEFAULT_SINK@ | grep -o 'no\|yes')"
    srcv="$(pactl get-source-volume @DEFAULT_SOURCE@ | grep -Po '\d+(?=%)' | head -n1)"
    srcm="$(pactl get-source-mute @DEFAULT_SOURCE@ | grep -o 'no\|yes')"
    [ "$sinkm" = "no" ] && sinkm='+' || sinkm='-'
    [ "$srcm" = "no" ] && srcm='+' || srcm='-'
    load="$(cat /proc/loadavg | cut -d' ' -f1)"
    time="$(date +'%a, %-d %b %Y %R %z')"
	printf "%s%% | %s%s,%s%s | %s | %s\n" \
           "$bat" \
           "$sinkv" "$sinkm" "$srcv" "$srcm" \
           "$load" "$time"
	sleep 5
done