zero posix compliance but cleaner

This commit is contained in:
tavo-wasd 2024-02-21 22:18:46 -06:00
parent 350ea17468
commit c4e20ef151
8 changed files with 22 additions and 28 deletions

View file

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# Reduces mic volume by 5% # Decreases mic volume by 5%
amixer set Capture 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

View file

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# Mute # Mute mic
amixer -q set Capture toggle 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

View file

@ -2,6 +2,7 @@
# Increases mic volume by 5% # Increases mic volume by 5%
amixer set Capture 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 kill -45 "$(pidof dwmblocks)" 2>/dev/null

View file

@ -2,6 +2,7 @@
# Mute # Mute
amixer -q set Master toggle 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 kill -44 "$(pidof dwmblocks)" 2>/dev/null

View file

@ -3,15 +3,11 @@
# (in current default Capture) # (in current default Capture)
# Get volume levels # 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 vol="${vol%\%*}" # Remove percentage sign
# If device is off (muted), notify mute, print volume otherwise # If device is off (muted), notify mute, print volume otherwise
if amixer scontents | grep "Capture" | grep -q "\[off\]"; then if amixer scontents | grep "Capture" | grep -q "\[off\]"; then echo " ──────────" && exit ; fi
echo " ──────────"
notify-send -u low --replace-id=11 " Silenced" 2>/dev/null
exit
fi
# Define bar progress with volume # Define bar progress with volume
case 1 in case 1 in
@ -30,4 +26,3 @@ esac
# Print and notify # Print and notify
echo " $bar" echo " $bar"
notify-send -u low --replace-id=11 " $bar" 2>/dev/null

View file

@ -3,15 +3,11 @@
# (in current default output) # (in current default output)
# Get volume level # 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 vol="${vol%\%*}" # Remove percentage sign
# If device is off (muted), notify mute, print volume otherwise # If device is off (muted), notify mute, print volume otherwise
if amixer scontents | grep "Playback" | grep -q "\[off\]"; then if amixer scontents | grep "Playback" | grep -q "\[off\]"; then echo "󰖁 ──────────" && exit ; fi
echo "󰖁 ──────────"
notify-send -u low --replace-id=10 "󰖁 Mute" 2>/dev/null
exit
fi
# Define bar progress with volume # Define bar progress with volume
case 1 in case 1 in
@ -29,5 +25,4 @@ case 1 in
esac esac
# Print and notify # Print and notify
notify-send -u low --replace-id=10 "󰕾 $bar" 2>/dev/null
echo "󰕾 $bar" echo "󰕾 $bar"

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# Increases volume by 5%, # Decreases volume by 5%
# then restarts statusbar module
amixer set Master 5%- unmute 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 kill -44 "$(pidof dwmblocks)" 2>/dev/null

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# Increases volume by 5%, # Increases volume by 5%
# then restarts statusbar module
amixer set Master 5%+ unmute 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 kill -44 "$(pidof dwmblocks)" 2>/dev/null