niksos/options/desktop/suspend.nix

26 lines
584 B
Nix
Raw Normal View History

2024-02-15 17:04:34 +01:00
{
inputs,
lib,
2024-02-15 17:04:34 +01:00
pkgs,
...
}: {
powerManagement = let
inherit (lib) getExe getExe';
mpc = getExe pkgs.mpc-cli;
sleep = getExe' pkgs.coreutils-full "sleep";
inherit (inputs.hyprland.packages.${pkgs.system}) hyprland;
hyprctl = getExe' hyprland "hyprctl";
in{
2024-02-15 17:04:34 +01:00
enable = true;
powerDownCommands = ''
${mpc} pause
${sleep} 1
2024-02-15 17:04:34 +01:00
'';
powerUpCommands = ''
${hyprctl} dispatch dpms off HDMI-A-1
${hyprctl} dispatch dpms on HDMI-A-1
2024-02-15 17:04:34 +01:00
'';
};
}