forked from poz/niksos
move onresume and onsuspend scripts to powerManagement
This commit is contained in:
parent
d869f576f7
commit
47043046d0
1 changed files with 11 additions and 41 deletions
|
@ -274,47 +274,17 @@
|
|||
];
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
"suspend@" = {
|
||||
description = "Unit suspend actions";
|
||||
before = [ "sleep.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
User = "%I";
|
||||
Type = "forking";
|
||||
};
|
||||
|
||||
environment = {
|
||||
DISPLAY = ":0";
|
||||
};
|
||||
|
||||
preStart = "${pkgs.mpc-cli}/bin/mpc pause";
|
||||
script = "${inputs.nixpkgs-wayland.packages.${pkgs.system}.swaylock-effects}/bin/swaylock";
|
||||
postStart = "${pkgs.coreutils-full}/bin/sleep 1";
|
||||
|
||||
wantedBy = [ "sleep.target" ];
|
||||
};
|
||||
|
||||
"resume@" = {
|
||||
description = "Unit resume actions";
|
||||
after = [ "suspend.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
User = "%I";
|
||||
Type = "forking";
|
||||
};
|
||||
|
||||
environment = {
|
||||
DISPLAY = ":0";
|
||||
};
|
||||
|
||||
script = ''
|
||||
${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch dpms off HDMI-A-1
|
||||
${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch dpms on HDMI-A-1
|
||||
'';
|
||||
|
||||
wantedBy = [ "sleep.target" ];
|
||||
};
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
powerDownCommands = ''
|
||||
${pkgs.mpc-cli}/bin/mpc pause
|
||||
${inputs.nixpkgs-wayland.packages.${pkgs.system}.swaylock-effects}/bin/swaylock
|
||||
${pkgs.coreutils-full}/bin/sleep 1
|
||||
'';
|
||||
powerUpCommands = ''
|
||||
${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch dpms off HDMI-A-1
|
||||
${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch dpms on HDMI-A-1
|
||||
'';
|
||||
};
|
||||
|
||||
# this makes usb devices autosuspend
|
||||
|
|
Loading…
Reference in a new issue