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