pinwheel: Toggle mute LED when (un)muting

This commit is contained in:
Alexander Heldt
2023-09-24 16:48:18 +02:00
parent a95d70734e
commit d5b416a5b8

View File

@@ -1,4 +1,11 @@
{ pkgs, ... }:
let
toggle-mute = pkgs.writeShellScript "foo" ''
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep MUTED | wc -l)
echo $MUTED > /sys/class/leds/platform::mute/brightness
'';
in
{
users.users.alex.extraGroups = [ "audio" ];
@@ -22,7 +29,7 @@
bind = [
", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 2%+"
", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioMute, exec, ${toggle-mute}"
", XF86AudioMicMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
];
};