From bfa7c06436771e3a0c666ccc6ee01e815d4c33aa Mon Sep 17 00:00:00 2001 From: Sergio Ribera <56278796+SergioRibera@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:55:00 -0400 Subject: [PATCH] swayosd: add custom style option --- modules/services/swayosd.nix | 11 +++++++++++ tests/modules/services/swayosd/swayosd.nix | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/services/swayosd.nix b/modules/services/swayosd.nix index 51e7eb6d..79ca7f5e 100644 --- a/modules/services/swayosd.nix +++ b/modules/services/swayosd.nix @@ -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"; diff --git a/tests/modules/services/swayosd/swayosd.nix b/tests/modules/services/swayosd/swayosd.nix index ba92d81f..88a7c536 100644 --- a/tests/modules/services/swayosd/swayosd.nix +++ b/tests/modules/services/swayosd/swayosd.nix @@ -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