From 465ea1f994a4e2b498b847c35caa205af7b261df Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Wed, 24 Jul 2024 05:37:28 +0000 Subject: [PATCH] swayosd: avoid restarting too quickly Should fix an issue where swayosd.service would stop without starting again after restarting too quickly. Triggered by ending a Hyprland session and logging in with tuigreet. Related: https://github.com/nix-community/home-manager/pull/4316 --- modules/services/swayosd.nix | 3 +++ tests/modules/services/swayosd/swayosd.nix | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/services/swayosd.nix b/modules/services/swayosd.nix index 79ca7f5e..869b4872 100644 --- a/modules/services/swayosd.nix +++ b/modules/services/swayosd.nix @@ -60,6 +60,8 @@ in { After = [ "graphical-session.target" ]; ConditionEnvironment = "WAYLAND_DISPLAY"; Documentation = "man:swayosd(1)"; + StartLimitBurst = 5; + StartLimitIntervalSec = 10; }; Service = { @@ -71,6 +73,7 @@ in { + (optionalString (cfg.topMargin != null) " --top-margin ${toString cfg.topMargin}"); Restart = "always"; + RestartSec = "2s"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; diff --git a/tests/modules/services/swayosd/swayosd.nix b/tests/modules/services/swayosd/swayosd.nix index 88a7c536..1bc7d535 100644 --- a/tests/modules/services/swayosd/swayosd.nix +++ b/tests/modules/services/swayosd/swayosd.nix @@ -23,6 +23,7 @@ [Service] ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style '/etc/xdg/swayosd/style.css' --top-margin 0.100000 Restart=always + RestartSec=2s Type=simple [Unit] @@ -31,6 +32,8 @@ Description=Volume/backlight OSD indicator Documentation=man:swayosd(1) PartOf=graphical-session.target + StartLimitBurst=5 + StartLimitIntervalSec=10 '' } '';