nixos/home/common/optional/desktop/dwm/scripts/dunstify-volume-notificatio...

31 lines
882 B
Nix

{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dunstify-volume-notification" ''
mute_test=$(${pamixer}/bin/pamixer --get-mute)
mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute)
mute=""
if [ "$mute_test" == true ];
then
mute="(Speakers Muted)"
fi
if [ "$mic_mute_test" == true ];
then
mute="(Mic Muted)"
fi
if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ];
then
mute="(Speakers Muted & Mic Muted)"
fi
volume=$(${pamixer}/bin/pamixer --get-volume)
msgTag="volume-notify"
${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000
'')
];
}