summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorAmin Bandali <bandali@kelar.org>2024-03-04 01:07:26 -0500
committerAmin Bandali <bandali@kelar.org>2024-03-04 01:07:26 -0500
commita83c6a243468801c8f51c0c509abb834cd46c6bd (patch)
treea62389d05e3e0cba4d2ee09c51c0b1e09cac99cc /.local/bin
parentffd0084f8612a11de7263b1dc627a3ed8f97d923 (diff)
downloadconfigs-a83c6a243468801c8f51c0c509abb834cd46c6bd.tar.gz
configs-a83c6a243468801c8f51c0c509abb834cd46c6bd.tar.xz
configs-a83c6a243468801c8f51c0c509abb834cd46c6bd.zip
Change my-bar to use pulseaudio's pactl instead of pamixer
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/my-bar14
1 files changed, 7 insertions, 7 deletions
diff --git a/.local/bin/my-bar b/.local/bin/my-bar
index 18f8a92..0f8e283 100755
--- a/.local/bin/my-bar
+++ b/.local/bin/my-bar
@@ -4,17 +4,17 @@ do
b0="/sys/class/power_supply/BAT0"
bat="$(cat $b0/capacity)"
# batl="$(cat $b0/capacity_level)"
- pm="pamixer --get-volume"
- pmm="pamixer --get-mute"
- vol="$($pm)"
- [ "$($pmm)" = "true" ] && volm='-' || volm='+'
- volmic="$($pm --default-source)"
- [ "$($pmm --default-source)" = "true" ] && volmicm='-' || volmicm='+'
+ 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" \
- "$vol" "$volm" "$volmic" "$volmicm" \
+ "$sinkv" "$sinkm" "$srcv" "$srcm" \
"$load" "$time"
sleep 5
done