From c4d96716c05c41a3b18f2326cb588cd19246da5f Mon Sep 17 00:00:00 2001 From: zachir Date: Fri, 12 Aug 2022 04:30:51 -0500 Subject: initial commit --- volume | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 volume (limited to 'volume') diff --git a/volume b/volume new file mode 100755 index 0000000..1c67faf --- /dev/null +++ b/volume @@ -0,0 +1,23 @@ +#!/sbin/sh + +case $BLOCK_BUTTON in + 1) + pgrep -x pipewire >/dev/null && MIXER="pulsemixer" || \ + pgrep -x pulseaudio >/dev/null && MIXER="pulsemixer" || \ + MIXER="alsamixer" + setsid -f $TERMINAL -e $MIXER + ;; + 2) notify-send "Volume module" "\- Shows volume, X if muted. +- Middle click to show this message. +- Right click to mute. +- Scroll to change." ;; + 3) volsv -t ;; + 4) volsv -i ;; + 5) volsv -d ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac +volstat="$(volsv -v)" +mutstat="$(volsv -g)" +echo "$mutstat" | grep -q "\[off\]" && printf "[X]" && exit +vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")" +printf "[%s]" "$vol" -- cgit v1.2.3