niksos/hosts/common/optional/suspend.nix

25 lines
542 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,
...
2024-07-24 18:47:53 +02:00
}: let
inherit (lib.meta) getExe getExe';
2024-07-24 18:47:53 +02:00
mpc = getExe pkgs.mpc-cli;
sleep = getExe' pkgs.coreutils-full "sleep";
2024-09-01 20:33:38 +02:00
hyprctl = getExe' inputs.hyprland.packages.${pkgs.system}.hyprland "hyprctl";
2024-07-24 18:47:53 +02:00
in {
powerManagement = {
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
'';
};
}