-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
Add dunst service #112100
Add dunst service #112100
Conversation
Dunst config values can be strings, booleans, or integers. These types allow users to intuitively use those. Note that reference configs may encode booleans as "yes" or "no". These work just fine as true/false.
Primarily what's needed here are quoted strings, but each type of value is included for completeness. This is a modified version of lib.generators.mkValueStringDefault.
This is suppressed by simply not specifying an icon path.
I made the choice to merge provided options into the default values because the default values are so large. Default values taken from example dunstrc at dunst 1.5.0.
Thanks for picking this up, I tested it on my system and looks good so far :) |
It would be misleading to see generators.mkValueStringDefault as the source of an error in the function for converting dunst values. Thinking about that more, dunstValueString is a name that I think adds confusion compared to dunstValue, so I renamed everything to be consistent.
toJSON does what I want here for all cases, simplifiying the logic.
7eba474
to
a839a67
Compare
There's something here that I'm not quite happy with when modifying the dunst configuration, and I think it has to do with it being a user service but I'm not too familiar with NixOS's management of that. I nixos-rebuild switch, and the systemd unit shows this line: |
Looking into the above some more it seems like the dunst process started by the systemd service isn't connected to the same dbus. Echoing DBUS_SESSION_BUS_ADDRESS in the service gives
until I start dunst in a terminal:
which explains why it would autostart dunst when a notification was sent, and is indicative to me that indeed the systemd dunst is not connecting to the right bus. |
I assume this is because NixOS is doing a daemon-reload on
the user units, and the command changed because the config file
changed.
Correct, nixos-rebuild switch will do a daemon-reload but won't
restart user servics. I'm not sure why, but it has been documented
in the manual[1].
However, testing this using `notify-send` (or any notification that
I'm testing) seems to always start a new dunst process that does not
use the right config.
That's most likely due to dbus autostarting dunst, skipping the unit
file. I'm not familiar with dbus so I don't know how any of this work,
but you could workaround it buy placing the configuration file in
/etc/dunst/dunstrc, instead of overriding the `ExecStart`.
[1]: https://nixos.org/manual/nixos/unstable/index.html#sect-nixos-systemd-nixos
|
I may have to do this if I can't pinpoint the problem soon. Right now I've found that I have three dbus-daemon processes running. Two "user" busses and one system bus. My hunch is there should only be one user bus. Here's a slice of my systemd cgroup tree:
Process 1845 is the one that's receiving notifications it seems. At the very least I see logs for the notifications I tested sending. Process 1879 doesn't seem to be logging anywhere, but I imagine that's the bus that dunst (process 1876) is connected to. My question now is: Why is dbus-daemon being launched under my session scope when there is a dbus service for it? Because it may be relevant now: NixOS version |
Upgrading to 20.09 seems to have fixed my issue. I saw a few issues related to dbus that were closed (I can't find them again now). Perhaps one of those fixed the duplicate daemons. I'm going to experiment with the daemon-reload now and see if I can get the dunst service to reload with the new config. |
It doesn't look like dunst provides any way to reload the configuration of a running process, and even if it did |
For reference here is the dunst issue for implementing config reload in the future: dunst-project/dunst#719 |
I marked this as stale due to inactivity. → More info |
@RocketPuppy Are you still interested in landing this? |
@abathur No, apologies. I don't have the time to wrap this up right now. |
No worries :) Just doing cleanup so that others don't try to pick it up. I'm going to tentatively close this, but I'm happy to reopen if you ping me. |
Motivation for this change
Picking up #58209 and adding examples, defaults, and rebasing on master to fix merge conflicts.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)