From a36b43bf4ed8ede466cc39e6c0e4d11f9855dd40 Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Wed, 12 Jul 2023 18:40:39 +0100 Subject: [PATCH] SXHKD: better volume --- hm_modules/sxhkd.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hm_modules/sxhkd.nix b/hm_modules/sxhkd.nix index 73e8b58..9155175 100644 --- a/hm_modules/sxhkd.nix +++ b/hm_modules/sxhkd.nix @@ -34,8 +34,15 @@ comm -23 <(bspc query -N | sort) <(bspc query -m primary -N | sort) | while read n; do bspc node $n -m primary; done ''; notifyVolume = pkgs.writeShellScript "notifyVolume" '' - volume=`${pamixer} --get-volume` - ${notify} -r 1 -h "int:value:$volume" "Volume $volume%" + PATH=$PATH:"${lib.makeBinPath [ pkgs.coreutils pkgs.pamixer ]}" + sink=`pamixer --get-default-sink | tail -n 1| sed -E 's/.+"(.+)"$/\1/'` + muted=`pamixer --get-mute` + volume=`pamixer --get-volume` + if [[ $muted == "true" ]]; then + ${notify} -r 1 -h "int:value:0" "Muted" "$sink" + else + ${notify} -r 1 -h "int:value:$volume" "Volume $volume%" "$sink" + fi ''; notifyBrightness = pkgs.writeShellScript "notifyBrightness" '' level=`printf "%.0f" $(${xbacklight} -get)`