From 0c44704f90205c7aaeb0e5a98a9ecbe44dbbc797 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Fri, 26 Mar 2021 13:30:58 +0100 Subject: [PATCH] Add volume script --- files/scripts/dwm_bar/volume.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 files/scripts/dwm_bar/volume.sh diff --git a/files/scripts/dwm_bar/volume.sh b/files/scripts/dwm_bar/volume.sh new file mode 100755 index 0000000..12e9660 --- /dev/null +++ b/files/scripts/dwm_bar/volume.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +SINK=$(pactl list short sinks | grep -n RUNNING | cut -d":" -f1) +if [ "$SINK" = "" ]; then + SINK=1 +fi +NOW=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $SINK | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' ) +MUTE=$(pactl list sinks | grep '^[[:space:]]Mute:'| head -n $SINK | tail -n 1 | awk -F ":" '{print $2}'| xargs) + +if [ "$MUTE" = "yes" ]; then + echo "$NOW%" +else + echo "$NOW%" +fi + +case $BLOCK_BUTTON in + 1) setsid -f st -c stpulse -n stpulse -e ncpamixer ;; +esac