1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 00:51:04 +01:00

swaync: use x-restart-triggers for reload (#6764)

Use x-restart-triggers to reload on file change, since users
with impermanence setups were running into issues with onChange and calling the `swaync-client` to handle the hot reload.
This commit is contained in:
Austin Horstman 2025-04-06 18:36:01 -07:00 committed by GitHub
parent ef3b2a6b60
commit 8c9b54504c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View file

@ -82,17 +82,13 @@ in {
home.packages = [ cfg.package pkgs.at-spi2-core ];
xdg.configFile = {
"swaync/config.json" = {
source = jsonFormat.generate "config.json" cfg.settings;
onChange = "${lib.getExe' cfg.package "swaync-client"} --reload-config";
};
"swaync/config.json".source =
jsonFormat.generate "config.json" cfg.settings;
"swaync/style.css" = lib.mkIf (cfg.style != null) {
source = if builtins.isPath cfg.style || lib.isStorePath cfg.style then
cfg.style
else
pkgs.writeText "swaync/style.css" cfg.style;
onChange = "${lib.getExe' cfg.package "swaync-client"} --reload-css";
};
};
@ -103,6 +99,11 @@ in {
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
ConditionEnvironment = "WAYLAND_DISPLAY";
X-Restart-Triggers = lib.mkMerge [
[ config.xdg.configFile."swaync/config.json".source ]
(lib.mkIf (cfg.style != null)
[ config.xdg.configFile."swaync/style.css".source ])
];
};
Service = {