summaryrefslogtreecommitdiffstats
path: root/.local/bin/my-bar
blob: 8a37d2fd7f55a7a0f77e49a139d53d4c8d07d524 (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