swayosd: add custom style option

This commit is contained in:
Sergio Ribera 2024-04-21 02:55:00 -04:00 committed by Robert Helgesson
parent 33a20182e3
commit bfa7c06436
No known key found for this signature in database
GPG Key ID: 96E745BD17AA17ED
2 changed files with 13 additions and 1 deletions

View File

@ -26,6 +26,15 @@ in {
description = "OSD margin from top edge (0.5 would be screen center).";
};
stylePath = mkOption {
type = types.nullOr types.path;
default = null;
example = "/etc/xdg/swayosd/style.css";
description = ''
Use a custom Stylesheet file instead of looking for one.
'';
};
display = mkOption {
type = types.nullOr types.str;
default = null;
@ -57,6 +66,8 @@ in {
Type = "simple";
ExecStart = "${cfg.package}/bin/swayosd-server"
+ (optionalString (cfg.display != null) " --display ${cfg.display}")
+ (optionalString (cfg.stylePath != null)
" --style ${escapeShellArg cfg.stylePath}")
+ (optionalString (cfg.topMargin != null)
" --top-margin ${toString cfg.topMargin}");
Restart = "always";

View File

@ -8,6 +8,7 @@
outPath = "@swayosd@";
};
display = "DISPLAY";
stylePath = "/etc/xdg/swayosd/style.css";
topMargin = 0.1;
};
@ -20,7 +21,7 @@
WantedBy=graphical-session.target
[Service]
ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --top-margin 0.100000
ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style '/etc/xdg/swayosd/style.css' --top-margin 0.100000
Restart=always
Type=simple