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
This commit is contained in:
Donovan Glover 2024-07-24 05:37:28 +00:00 committed by GitHub
parent 7560dc942a
commit 465ea1f994
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -60,6 +60,8 @@ in {
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
ConditionEnvironment = "WAYLAND_DISPLAY"; ConditionEnvironment = "WAYLAND_DISPLAY";
Documentation = "man:swayosd(1)"; Documentation = "man:swayosd(1)";
StartLimitBurst = 5;
StartLimitIntervalSec = 10;
}; };
Service = { Service = {
@ -71,6 +73,7 @@ in {
+ (optionalString (cfg.topMargin != null) + (optionalString (cfg.topMargin != null)
" --top-margin ${toString cfg.topMargin}"); " --top-margin ${toString cfg.topMargin}");
Restart = "always"; Restart = "always";
RestartSec = "2s";
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };

View file

@ -23,6 +23,7 @@
[Service] [Service]
ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style '/etc/xdg/swayosd/style.css' --top-margin 0.100000 ExecStart=@swayosd@/bin/swayosd-server --display DISPLAY --style '/etc/xdg/swayosd/style.css' --top-margin 0.100000
Restart=always Restart=always
RestartSec=2s
Type=simple Type=simple
[Unit] [Unit]
@ -31,6 +32,8 @@
Description=Volume/backlight OSD indicator Description=Volume/backlight OSD indicator
Documentation=man:swayosd(1) Documentation=man:swayosd(1)
PartOf=graphical-session.target PartOf=graphical-session.target
StartLimitBurst=5
StartLimitIntervalSec=10
'' ''
} }
''; '';