diff --git a/modules/services/swaync.nix b/modules/services/swaync.nix index 5f813af30..b1a86575e 100644 --- a/modules/services/swaync.nix +++ b/modules/services/swaync.nix @@ -73,6 +73,15 @@ in { for the documentation. ''; }; + + systemdTarget = lib.mkOption { + type = lib.types.str; + default = "graphical-session.target"; + example = "sway-session.target"; + description = '' + Systemd target to bind to. + ''; + }; }; config = lib.mkIf cfg.enable { @@ -95,9 +104,6 @@ in { Unit = { Description = "Swaync notification daemon"; Documentation = "https://github.com/ErikReider/SwayNotificationCenter"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session-pre.target" ]; - ConditionEnvironment = "WAYLAND_DISPLAY"; }; Service = { @@ -107,7 +113,7 @@ in { Restart = "on-failure"; }; - Install.WantedBy = [ "graphical-session.target" ]; + Install.WantedBy = [ cfg.systemdTarget ]; }; }; } diff --git a/tests/modules/services/swaync/swaync.nix b/tests/modules/services/swaync/swaync.nix index ceb3bf065..99e976a66 100644 --- a/tests/modules/services/swaync/swaync.nix +++ b/tests/modules/services/swaync/swaync.nix @@ -24,11 +24,8 @@ Type=dbus [Unit] - After=graphical-session-pre.target - ConditionEnvironment=WAYLAND_DISPLAY Description=Swaync notification daemon Documentation=https://github.com/ErikReider/SwayNotificationCenter - PartOf=graphical-session.target '' } '';