Update audio scripts to use PulseAudio

This commit is contained in:
samedamci 2021-01-18 17:48:00 +01:00
parent f8ec19d86c
commit 947428a45e
No known key found for this signature in database
GPG Key ID: FCB4A9A20D00E894
2 changed files with 10 additions and 10 deletions

View File

@ -50,10 +50,10 @@ Pause
# mute # mute
XF86AudioMute XF86AudioMute
amixer sset Master toggle && pkill -RTMIN+1 dwmblocks pamixer -t && pkill -RTMIN+1 dwmblocks
# volume control # volume control
XF86Audio{Raise,Lower}Volume XF86Audio{Raise,Lower}Volume
amixer sset Master 5%{+,-} && pkill -RTMIN+1 dwmblocks pamixer -{i,d}3 && pkill -RTMIN+1 dwmblocks
# songs control # songs control
XF86Audio{Next,Prev} XF86Audio{Next,Prev}
playerctl {next,previous} && pkill -RTMIN+2 dwmblocks playerctl {next,previous} && pkill -RTMIN+2 dwmblocks

View File

@ -1,23 +1,23 @@
#!/bin/sh #!/bin/sh
[ "$(amixer sget Master | awk 'NR==5 { print $6 }')" = "[off]" ] && { # Actually PulseAudio
[ "$(pamixer --get-mute)" = "true" ] && {
echo " mut" && exit 1 echo " mut" && exit 1
} }
level="$(pamixer --get-volume)"
level=$(amixer sget Master | awk -F"[][]" '/dB/ { print $2 }')
revel="${level%?}"
v1="" v1=""
v2="" v2=""
v3="" v3=""
if [ "$revel" -lt 35 ]; then if [ "$level" -lt 35 ]; then
printf "$v1 " printf "$v1 "
elif [ "$revel" -lt 60 ]; then elif [ "$level" -lt 60 ]; then
printf "$v2 " printf "$v2 "
elif [ "$revel" -lt 100 ]; then elif [ "$level" -lt 100 ]; then
printf "$v3 " printf "$v3 "
fi fi
echo "$level" echo "$level%"