swayosd: add systemdTarget option

This commit is contained in:
David Warde-Farley 2024-06-08 11:41:58 +01:00
parent a7117efb37
commit 52a0ff174b
2 changed files with 14 additions and 4 deletions

View file

@ -43,6 +43,15 @@ in {
X display to use.
'';
};
systemdTarget = mkOption {
type = types.str;
default = "graphical-session.target";
example = "sway-session.target";
description = ''
Systemd target to bind to.
'';
};
};
config = mkIf cfg.enable {
@ -56,8 +65,8 @@ in {
services.swayosd = {
Unit = {
Description = "Volume/backlight OSD indicator";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
PartOf = [ cfg.systemdTarget ];
After = [ cfg.systemdTarget ];
ConditionEnvironment = "WAYLAND_DISPLAY";
Documentation = "man:swayosd(1)";
};

View file

@ -10,6 +10,7 @@
display = "DISPLAY";
stylePath = "/etc/xdg/swayosd/style.css";
topMargin = 0.1;
systemdTarget = "test.target";
};
nmt.script = ''
@ -26,11 +27,11 @@
Type=simple
[Unit]
After=graphical-session.target
After=test.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Volume/backlight OSD indicator
Documentation=man:swayosd(1)
PartOf=graphical-session.target
PartOf=test.target
''
}
'';