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

31 lines
882 B
Nix
Raw Permalink Normal View History

2024-06-14 21:48:43 +01:00
{ pkgs, ... }:
{
home.packages = with pkgs; [
(writeShellScriptBin "dunstify-volume-notification" ''
2024-06-14 22:00:56 +01:00
mute_test=$(${pamixer}/bin/pamixer --get-mute)
mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute)
2024-06-14 21:48:43 +01:00
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
2024-06-14 22:00:56 +01:00
volume=$(${pamixer}/bin/pamixer --get-volume)
2024-06-14 21:48:43 +01:00
msgTag="volume-notify"
2024-06-14 22:00:56 +01:00
${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000
2024-06-14 21:48:43 +01:00
'')
];
}