From 145b19d82dddf974593a8b14bbfe3719ebf74d0c Mon Sep 17 00:00:00 2001 From: David Date: Sat, 12 Sep 2020 19:12:32 +0200 Subject: [PATCH] feat: switch sound management to amixer --- .config/sxhkd/sxhkdrc | 2 +- .local/bin/audio_notify | 6 +++--- .local/bin/dwmbar | 10 +++++----- .xprofile | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index fc1e706..30afa5b 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -3,7 +3,7 @@ # System stuff {F1, F2, F3} - pamixer {--toggle-mute, --decrease 5, --increase 5}; refbar; audio_notify + amixer --quiet set Master {toggle, 5%-, 5%+}; refbar; audio_notify {F5, F6} sbacklight {dec,inc} diff --git a/.local/bin/audio_notify b/.local/bin/audio_notify index 31362df..0f41587 100755 --- a/.local/bin/audio_notify +++ b/.local/bin/audio_notify @@ -10,10 +10,10 @@ ###################################################################### -level=$(pamixer --get-volume) -muted=$(pamixer --get-mute) +level="$(amixer sget Master | awk -F "[][]" ' { printf "%s", $2 }' | awk -F "%" '{printf $1}')" +muted="$(amixer sget Master | awk -F "[][]" '/%/ { printf "%4s", $4 }' | awk '{printf $1}')" -if [ "$muted" = "true" ]; then +if [ "$muted" = "off" ]; then dunstify -r 100002 "Sound muted" "$level%" else case "$level" in diff --git a/.local/bin/dwmbar b/.local/bin/dwmbar index 8665b9f..5c1fe02 100755 --- a/.local/bin/dwmbar +++ b/.local/bin/dwmbar @@ -18,13 +18,13 @@ delim=" | " # Set the delimiter character. status() { \ # Get the volume of ALSA's master volume output. - volume="$(pamixer --get-volume)" - muted="$(pamixer --get-mute)" + level="$(amixer sget Master | awk -F "[][]" ' { printf "%s", $2 }' | awk -F "%" '{printf $1}')" + muted="$(amixer sget Master | awk -F "[][]" '/%/ { printf "%4s", $4 }' | awk '{printf $1}')" - if [ "$muted" = "true" ]; then - printf " muted" + if [ "$muted" = "off" ]; then + printf " 婢 ---" else - printf " 墳 %3d%%" $volume + printf " 墳 %3d%%" $level fi printf "$delim" diff --git a/.xprofile b/.xprofile index f818cbd..c1f23de 100644 --- a/.xprofile +++ b/.xprofile @@ -7,7 +7,7 @@ xss-lock -- slock & redshift & dunst -follow mouse & -pamixer --set-volume 50 & +amixer set Master 50% sbacklight set 3 & bat_notify & AC_notify &