niksos/options/desktop/suspend.nix

25 lines
584 B
Nix

{
inputs,
lib,
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{
enable = true;
powerDownCommands = ''
${mpc} pause
${sleep} 1
'';
powerUpCommands = ''
${hyprctl} dispatch dpms off HDMI-A-1
${hyprctl} dispatch dpms on HDMI-A-1
'';
};
}