1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

swayosd: Remove non-existing display arg option (#7752)

This commit is contained in:
Gaspard Culis 2025-09-03 14:42:44 +02:00 committed by GitHub
parent 30fc1b5326
commit 6159629d05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 60 additions and 12 deletions

View file

@ -18,6 +18,14 @@ in
{
meta.maintainers = [ lib.hm.maintainers.pltanton ];
imports = [
(lib.mkRemovedOptionModule [
"services"
"swayosd"
"display"
] "The --display flag is no longer available in swayosd-server.")
];
options.services.swayosd = {
enable = lib.mkEnableOption ''
swayosd, a GTK based on screen display for keyboard shortcuts like
@ -45,15 +53,6 @@ in
Use a custom Stylesheet file instead of looking for one.
'';
};
display = mkOption {
type = types.nullOr types.str;
default = null;
example = "eDP-1";
description = ''
X display to use.
'';
};
};
config = lib.mkIf cfg.enable {
@ -79,7 +78,6 @@ in
Type = "simple";
ExecStart =
"${cfg.package}/bin/swayosd-server"
+ (optionalString (cfg.display != null) " --display ${cfg.display}")
+ (optionalString (cfg.stylePath != null) " --style ${lib.escapeShellArg cfg.stylePath}")
+ (optionalString (cfg.topMargin != null) " --top-margin ${toString cfg.topMargin}");
Restart = "always";

View file

@ -2,4 +2,5 @@
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
swayosd = ./swayosd.nix;
swayosd-with-deprecated-options = ./deprecated-options.nix;
}

View file

@ -0,0 +1,50 @@
{
lib,
config,
options,
...
}:
{
services.swayosd = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "swayosd";
outPath = "@swayosd@";
};
display = "DISPLAY";
stylePath = "/etc/xdg/swayosd/style.css";
topMargin = 0.1;
};
test.asserts.assertions.expected = [
''
The option definition `services.swayosd.display' in ${lib.showFiles options.services.swayosd.display.files} no longer has any effect; please remove it.
The --display flag is no longer available in swayosd-server.
''
];
nmt.script = ''
assertFileContent \
home-files/.config/systemd/user/swayosd.service \
${builtins.toFile "swayosd.service" ''
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=@swayosd@/bin/swayosd-server --style /etc/xdg/swayosd/style.css --top-margin 0.100000
Restart=always
RestartSec=2s
Type=simple
[Unit]
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Volume/backlight OSD indicator
Documentation=man:swayosd(1)
PartOf=graphical-session.target
StartLimitBurst=5
StartLimitIntervalSec=10
''}
'';
}

View file

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