From 89fe48b1c1c51d5616343b71822a45f894b16dcf Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 31 Dec 2024 09:57:06 +0000 Subject: [PATCH] swayidle: use config.wayland.systemd.target Also add `Unit.After`. --- modules/services/swayidle.nix | 6 ++++-- tests/modules/services/swayidle/basic-configuration.nix | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index 7f3376a1..fbb91db5 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -88,7 +88,8 @@ in { systemdTarget = mkOption { type = types.str; - default = "graphical-session.target"; + default = config.wayland.systemd.target; + defaultText = literalExpression "config.wayland.systemd.target"; example = "sway-session.target"; description = '' Systemd target to bind to. @@ -107,7 +108,8 @@ in { Description = "Idle manager for Wayland"; Documentation = "man:swayidle(1)"; ConditionEnvironment = "WAYLAND_DISPLAY"; - PartOf = [ "graphical-session.target" ]; + PartOf = [ cfg.systemdTarget ]; + After = [ cfg.systemdTarget ]; }; Service = { diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index c38f4d67..c863883b 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, ... }: { services.swayidle = { @@ -50,6 +50,7 @@ Type=simple [Unit] + After=graphical-session.target ConditionEnvironment=WAYLAND_DISPLAY Description=Idle manager for Wayland Documentation=man:swayidle(1)