mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
hypridle: configurable systemd target
This commit is contained in:
parent
8f6ca7855d
commit
e777fd4282
2 changed files with 19 additions and 2 deletions
|
@ -11,6 +11,20 @@ in {
|
||||||
|
|
||||||
package = mkPackageOption pkgs "hypridle" { };
|
package = mkPackageOption pkgs "hypridle" { };
|
||||||
|
|
||||||
|
systemd = {
|
||||||
|
enable = lib.mkEnableOption "Hypridle Systemd integration" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
target = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "graphical-session.target";
|
||||||
|
example = "hyprland-session.target";
|
||||||
|
description = ''
|
||||||
|
The systemd target that will automatically start the hypridle service.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
settings = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
type = with lib.types;
|
type = with lib.types;
|
||||||
let
|
let
|
||||||
|
@ -73,8 +87,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.services.hypridle = {
|
systemd.user.services.hypridle = mkIf cfg.systemd.enable {
|
||||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
Install = { WantedBy = [ cfg.systemd.target ]; };
|
||||||
|
|
||||||
Unit = {
|
Unit = {
|
||||||
ConditionEnvironment = "WAYLAND_DISPLAY";
|
ConditionEnvironment = "WAYLAND_DISPLAY";
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.hypridle;
|
package = pkgs.hypridle;
|
||||||
|
|
||||||
|
systemd.target = "hyprland-session.target";
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||||
|
@ -34,5 +36,6 @@
|
||||||
assertFileExists $config
|
assertFileExists $config
|
||||||
assertFileExists $clientServiceFile
|
assertFileExists $clientServiceFile
|
||||||
assertFileContent $config ${./hypridle.conf}
|
assertFileContent $config ${./hypridle.conf}
|
||||||
|
assertFileContains $clientServiceFile "WantedBy=hyprland-session.target"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue