diff --git a/scripts/micdown b/scripts/micdown index 3161ba5..437215f 100755 --- a/scripts/micdown +++ b/scripts/micdown @@ -1,7 +1,8 @@ #!/bin/sh -# Reduces mic volume by 5% +# Decreases mic volume by 5% amixer set Capture 5%- -$HOME/.config/scripts/status/micstat -kill -45 "$(pidof dwmblocks)" +MICSTAT="$(micstat)" +notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null +kill -45 "$(pidof dwmblocks)" 2>/dev/null diff --git a/scripts/micmute b/scripts/micmute index 2dbbf4c..642ff31 100755 --- a/scripts/micmute +++ b/scripts/micmute @@ -1,7 +1,8 @@ #!/bin/sh -# Mute +# Mute mic amixer -q set Capture toggle -$HOME/.config/scripts/status/micstat -kill -45 "$(pidof dwmblocks)" +MICSTAT="$(micstat)" +notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null +kill -45 "$(pidof dwmblocks)" 2>/dev/null diff --git a/scripts/micup b/scripts/micup index 1f4614e..9dc8c12 100755 --- a/scripts/micup +++ b/scripts/micup @@ -2,6 +2,7 @@ # Increases mic volume by 5% amixer set Capture 5%+ -$HOME/.config/scripts/status/micstat +MICSTAT="$(micstat)" +notify-send -u low --replace-id=11 "$MICSTAT" 2>/dev/null kill -45 "$(pidof dwmblocks)" 2>/dev/null diff --git a/scripts/mute b/scripts/mute index 6aa06a9..6c4c6e5 100755 --- a/scripts/mute +++ b/scripts/mute @@ -2,6 +2,7 @@ # Mute amixer -q set Master toggle -$HOME/.config/scripts/status/volstat +VOLSTAT="$(volstat)" +notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null kill -44 "$(pidof dwmblocks)" 2>/dev/null diff --git a/scripts/status/micstat b/scripts/status/micstat index 2a231b9..474c901 100755 --- a/scripts/status/micstat +++ b/scripts/status/micstat @@ -3,15 +3,11 @@ # (in current default Capture) # Get volume levels -vol=$(amixer | grep "Capture" | grep -o '[0-9]*[0-9]%' | tail -n 1) +vol=$(amixer | grep "Capture" | grep -m 1 -o '[0-9]*[0-9]%') vol="${vol%\%*}" # Remove percentage sign # If device is off (muted), notify mute, print volume otherwise -if amixer scontents | grep "Capture" | grep -q "\[off\]"; then - echo " ──────────" - notify-send -u low --replace-id=11 " Silenced" 2>/dev/null - exit -fi +if amixer scontents | grep "Capture" | grep -q "\[off\]"; then echo " ──────────" && exit ; fi # Define bar progress with volume case 1 in @@ -30,4 +26,3 @@ esac # Print and notify echo " $bar" -notify-send -u low --replace-id=11 " $bar" 2>/dev/null diff --git a/scripts/status/volstat b/scripts/status/volstat index 273db95..bd3e540 100755 --- a/scripts/status/volstat +++ b/scripts/status/volstat @@ -3,15 +3,11 @@ # (in current default output) # Get volume level -vol=$(amixer | grep "Playback" | grep -o '[0-9]*[0-9]%' | head -n 1) +vol=$(amixer | grep "Playback" | grep -m 1 -o '[0-9]*[0-9]%') vol="${vol%\%*}" # Remove percentage sign # If device is off (muted), notify mute, print volume otherwise -if amixer scontents | grep "Playback" | grep -q "\[off\]"; then - echo "󰖁 ──────────" - notify-send -u low --replace-id=10 "󰖁 Mute" 2>/dev/null - exit -fi +if amixer scontents | grep "Playback" | grep -q "\[off\]"; then echo "󰖁 ──────────" && exit ; fi # Define bar progress with volume case 1 in @@ -29,5 +25,4 @@ case 1 in esac # Print and notify -notify-send -u low --replace-id=10 "󰕾 $bar" 2>/dev/null echo "󰕾 $bar" diff --git a/scripts/voldown b/scripts/voldown index 1c06a10..cc3904d 100755 --- a/scripts/voldown +++ b/scripts/voldown @@ -1,8 +1,8 @@ #!/bin/sh -# Increases volume by 5%, -# then restarts statusbar module +# Decreases volume by 5% amixer set Master 5%- unmute -$HOME/.config/scripts/status/volstat +VOLSTAT="$(volstat)" +notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null kill -44 "$(pidof dwmblocks)" 2>/dev/null diff --git a/scripts/volup b/scripts/volup index 3c03aa3..2a19160 100755 --- a/scripts/volup +++ b/scripts/volup @@ -1,8 +1,8 @@ #!/bin/sh -# Increases volume by 5%, -# then restarts statusbar module +# Increases volume by 5% amixer set Master 5%+ unmute -$HOME/.config/scripts/status/volstat +VOLSTAT="$(volstat)" +notify-send -u low --replace-id=10 "$VOLSTAT" 2>/dev/null kill -44 "$(pidof dwmblocks)" 2>/dev/null