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 = {
|
powerManagement = {
|
||||||
"suspend@" = {
|
enable = true;
|
||||||
description = "Unit suspend actions";
|
powerDownCommands = ''
|
||||||
before = [ "sleep.target" ];
|
${pkgs.mpc-cli}/bin/mpc pause
|
||||||
|
${inputs.nixpkgs-wayland.packages.${pkgs.system}.swaylock-effects}/bin/swaylock
|
||||||
serviceConfig = {
|
${pkgs.coreutils-full}/bin/sleep 1
|
||||||
User = "%I";
|
'';
|
||||||
Type = "forking";
|
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
|
||||||
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" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# this makes usb devices autosuspend
|
# this makes usb devices autosuspend
|
||||||
|
|
Loading…
Reference in a new issue