mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
hypridle: add systemdTarget
option
- added `systemdTarget` option - updated test to include new option - added documentation link to systemd service
This commit is contained in:
parent
1d0862ee2d
commit
8cf61627a0
3 changed files with 38 additions and 1 deletions
|
@ -63,6 +63,19 @@ in {
|
|||
List of prefix of attributes to source at the top of the config.
|
||||
'';
|
||||
};
|
||||
|
||||
systemdTarget = 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.
|
||||
|
||||
When setting this value to `"hyprland-session.target"`,
|
||||
make sure to also enable {option}`wayland.windowManager.hyprland.systemd.enable`,
|
||||
otherwise the service may never be started.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -74,11 +87,12 @@ in {
|
|||
};
|
||||
|
||||
systemd.user.services.hypridle = {
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
||||
|
||||
Unit = {
|
||||
ConditionEnvironment = "WAYLAND_DISPLAY";
|
||||
Description = "hypridle";
|
||||
Documentation = "https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
X-Restart-Triggers =
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemdTarget = "hyprland-session.target";
|
||||
};
|
||||
|
||||
test.stubs.hypridle = { };
|
||||
|
@ -34,5 +36,11 @@
|
|||
assertFileExists $config
|
||||
assertFileExists $clientServiceFile
|
||||
assertFileContent $config ${./hypridle.conf}
|
||||
|
||||
serviceFile=$(normalizeStorePaths $clientServiceFile)
|
||||
assertFileContent "$serviceFile" ${
|
||||
./systemd-with-graphical-session-target.service
|
||||
}
|
||||
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
[Install]
|
||||
WantedBy=hyprland-session.target
|
||||
|
||||
[Service]
|
||||
ExecStart=@hypridle@/bin/dummy
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Unit]
|
||||
After=graphical-session-pre.target
|
||||
ConditionEnvironment=WAYLAND_DISPLAY
|
||||
Description=hypridle
|
||||
Documentation=https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/
|
||||
PartOf=graphical-session.target
|
||||
X-Restart-Triggers=/nix/store/00000000000000000000000000000000-hm_hyprhypridle.conf
|
Loading…
Reference in a new issue