From 656ae5aba2d48adfe5bb3aa8d433b9a50cfb2a11 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 31 Dec 2024 10:16:58 +0000 Subject: [PATCH] clipman: use config.wayland.systemd.target Also add `ConditionEnvironment`. --- modules/services/clipman.nix | 8 +++++--- .../services/clipman/clipman-sway-session-target.service | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/services/clipman.nix b/modules/services/clipman.nix index 4616c298..3a93773f 100644 --- a/modules/services/clipman.nix +++ b/modules/services/clipman.nix @@ -11,7 +11,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 = '' The systemd target that will automatically start the clipman service. @@ -34,8 +35,9 @@ in { systemd.user.services.clipman = { Unit = { Description = "Clipboard management daemon"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session.target" ]; + PartOf = [ cfg.systemdTarget ]; + After = [ cfg.systemdTarget ]; + ConditionEnvironment = "WAYLAND_DISPLAY"; }; Service = { diff --git a/tests/modules/services/clipman/clipman-sway-session-target.service b/tests/modules/services/clipman/clipman-sway-session-target.service index 0d0478cc..49de2ee3 100644 --- a/tests/modules/services/clipman/clipman-sway-session-target.service +++ b/tests/modules/services/clipman/clipman-sway-session-target.service @@ -8,6 +8,7 @@ KillMode=mixed Restart=on-failure [Unit] -After=graphical-session.target +After=sway-session.target +ConditionEnvironment=WAYLAND_DISPLAY Description=Clipboard management daemon -PartOf=graphical-session.target +PartOf=sway-session.target