pinwheel: Fix mic mute LED toggle

This commit is contained in:
Alexander Heldt
2023-09-26 21:03:38 +02:00
parent 9517dcf48f
commit 58f25b87aa

View File

@@ -1,10 +1,16 @@
{ pkgs, ... }:
let
toggle-mute = pkgs.writeShellScript "foo" ''
toggle-output-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
'';
toggle-input-mute = pkgs.writeShellScript "foo" ''
${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
MUTED=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep MUTED | wc -l)
echo $MUTED > /sys/class/leds/platform::micmute/brightness
'';
in
{
users.users.alex.extraGroups = [ "audio" ];
@@ -29,8 +35,8 @@ in
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, ${toggle-mute}"
", XF86AudioMicMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
", XF86AudioMute, exec, ${toggle-output-mute}"
", XF86AudioMicMute, exec, ${toggle-input-mute}"
];
};
};