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 ]; home.packages = [ cfg.package pkgs.at-spi2-core ];
xdg.configFile = { xdg.configFile = {
"swaync/config.json" = { "swaync/config.json".source =
source = jsonFormat.generate "config.json" cfg.settings; jsonFormat.generate "config.json" cfg.settings;
onChange = "${lib.getExe' cfg.package "swaync-client"} --reload-config";
};
"swaync/style.css" = lib.mkIf (cfg.style != null) { "swaync/style.css" = lib.mkIf (cfg.style != null) {
source = if builtins.isPath cfg.style || lib.isStorePath cfg.style then source = if builtins.isPath cfg.style || lib.isStorePath cfg.style then
cfg.style cfg.style
else else
pkgs.writeText "swaync/style.css" cfg.style; 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 ]; PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ]; After = [ config.wayland.systemd.target ];
ConditionEnvironment = "WAYLAND_DISPLAY"; 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 = { Service = {

View file

@ -10,8 +10,11 @@
}; };
nmt.script = '' nmt.script = ''
serviceFile=home-files/.config/systemd/user/swaync.service
serviceFile=$(normalizeStorePaths $serviceFile)
assertFileContent \ assertFileContent \
home-files/.config/systemd/user/swaync.service \ $serviceFile \
${ ${
builtins.toFile "swaync.service" '' builtins.toFile "swaync.service" ''
[Install] [Install]
@ -29,6 +32,7 @@
Description=Swaync notification daemon Description=Swaync notification daemon
Documentation=https://github.com/ErikReider/SwayNotificationCenter Documentation=https://github.com/ErikReider/SwayNotificationCenter
PartOf=graphical-session.target PartOf=graphical-session.target
X-Restart-Triggers=/nix/store/00000000000000000000000000000000-config.json
'' ''
} }
''; '';