feat: mute 'astyanax' speakers when disconnecting AC
This commit is contained in:
@@ -26,12 +26,13 @@ in
|
|||||||
device = "/dev/nvme0n1";
|
device = "/dev/nvme0n1";
|
||||||
})
|
})
|
||||||
../../modules/desktops/niri
|
../../modules/desktops/niri
|
||||||
|
../../modules/audio
|
||||||
|
../../modules/audio-automation
|
||||||
../../modules/backups
|
../../modules/backups
|
||||||
../../modules/bluetooth
|
../../modules/bluetooth
|
||||||
../../modules/keyboard
|
../../modules/keyboard
|
||||||
(import ../../modules/networking { inherit hostName; })
|
(import ../../modules/networking { inherit hostName; })
|
||||||
../../modules/users
|
../../modules/users
|
||||||
../../modules/audio
|
|
||||||
../../modules/localization
|
../../modules/localization
|
||||||
../../modules/fonts
|
../../modules/fonts
|
||||||
../../modules/ssh/hardened-openssh.nix
|
../../modules/ssh/hardened-openssh.nix
|
||||||
|
|||||||
17
modules/audio-automation/default.nix
Normal file
17
modules/audio-automation/default.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ pkgs.libnotify ];
|
||||||
|
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
SUBSYSTEM=="power_supply", ATTR{online}=="0", ACTION=="change", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="mute-audio.service"
|
||||||
|
'';
|
||||||
|
|
||||||
|
systemd.user.services.mute-audio = {
|
||||||
|
description = "mute audio when switching to battery power";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.pulseaudio}/bin/pactl set-sink-mute $(${pkgs.pulseaudio}/bin/pactl get-default-sink) true && ${pkgs.libnotify}/bin/notify-send \"audio Muted\" \"switched to battery power\"'";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user