From 22a270eba9568af1394a46429f1a379200496cf9 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 1 Apr 2024 15:21:11 -0400 Subject: Break pulse volume code out of bar and into its own script In part so that it could easily be used in Emacs as well. Also rename pacify-pulseaudio to b-pacify (as in PAcify). --- .local/bin/b-pavols | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .local/bin/b-pavols (limited to '.local/bin/b-pavols') diff --git a/.local/bin/b-pavols b/.local/bin/b-pavols new file mode 100755 index 0000000..76606e2 --- /dev/null +++ b/.local/bin/b-pavols @@ -0,0 +1,23 @@ +#!/bin/sh + +# default sink (output) +sink_volume="$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '\d+(?=%)' | head -n1)" +sink_mute="$(pactl get-sink-mute @DEFAULT_SINK@ | grep -o 'no\|yes')" +# default source (input) +source_volume="$(pactl get-source-volume @DEFAULT_SOURCE@ | grep -Po '\d+(?=%)' | head -n1)" +source_mute="$(pactl get-source-mute @DEFAULT_SOURCE@ | grep -o 'no\|yes')" + +if [ "$sink_mute" = "no" ]; then + sink_mute='+' +else + sink_mute='-' +fi + +if [ "$source_mute" = "no" ]; then + source_mute='+' +else + source_mute='-' +fi + +printf "%s%s,%s%s\n" \ + "$sink_volume" "$sink_mute" "$source_volume" "$source_mute" -- cgit v1.2.3-60-g2f50