-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swaync: Add onChange #6233
base: master
Are you sure you want to change the base?
swaync: Add onChange #6233
Conversation
Hmm, my implementation might not be the best way to do this. Judging by other usages of
I am not sure what the preferred method is though. |
Call swanyc-client with the argument reload-css/reload-config when config/CSS is changed.
eb82243
to
37a6161
Compare
Thanks for the contribution, you could give diff --git a/modules/services/swaync.nix b/modules/services/swaync.nix
index 5f813af3..8512d794 100644
--- a/modules/services/swaync.nix
+++ b/modules/services/swaync.nix
@@ -98,6 +98,11 @@ in {
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.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 = {
diff --git a/tests/modules/services/swaync/swaync.nix b/tests/modules/services/swaync/swaync.nix
index ceb3bf06..777e0d8c 100644
--- a/tests/modules/services/swaync/swaync.nix
+++ b/tests/modules/services/swaync/swaync.nix
@@ -10,8 +10,11 @@
};
nmt.script = ''
+ serviceFile=home-files/.config/systemd/user/swaync.service
+ serviceFile=$(normalizeStorePaths $serviceFile)
+
assertFileContent \
- home-files/.config/systemd/user/swaync.service \
+ $serviceFile \
${
builtins.toFile "swaync.service" ''
[Install]
@@ -29,6 +32,7 @@
Description=Swaync notification daemon
Documentation=https://github.com/ErikReider/SwayNotificationCenter
PartOf=graphical-session.target
+ X-Restart-Triggers=/nix/store/00000000000000000000000000000000-config.json
''
}
''; a try for a more generic solution. |
@LemmusLemmus While your change would work great for people running home-manager through the home-manager CLI that runs activationscripts within your shell. Many people activate through the home-manager nixos module, so relying on systemd as @rycee suggests is the better option, give it a try! |
Sorry for the delay, I am not dismissing the suggestion :) I might mention that I am using home-manager as a NixOS module (through flakes). After removing my changes and copying the changes that rycee suggested, nothing seems to happen when I rebuild with a different style? I am probably doing something wrong though, or could it perhaps be that it restarts I assume that
This By the way, the home manager manual seems to suggest that it should be enough to run |
Regarding home-manager overrides to start contributing. There's a thousand ways to do it. The easiest way when developing a single module might be setting disabledModules = [ "path/in/hm/to/module.nix" ]; Then copying the entire thing into your own config folder, start hacking away and copy it into HM when it's ready for some kind of review. I'm LilleCarl at Matrix.org, happy to help anyone who's got the energy to contribute! 😄 EDIT: I can't test your changes as all my only machine is a Chromebook, so I don't run any Wayland apps 😢 |
Calls swanyc-client with the argument reload-css/reload-config when config/CSS is changed.
Description
I have simply added calls to
swaync --reload-css
andswaync --reload-config
for when the config or CSS are changed, so that changes take effect immediately.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
Maintainer CC
@abayomi185