dunst icon indicating copy to clipboard operation
dunst copied to clipboard

[RFC] config reload mechanism

Open bynect opened this issue 1 year ago • 8 comments

I wanted to add a way to reload the config files. part of the code is taken from #968.

In respect to #968 I added the ability to pass a list of config files to use to the dbus method. If none are passed it will use the old config list.

I noticed that the cmdline parser ignores multiple -conf options (without any acknowledgment of the fact). So I changed the behavior to accept a list of files.


Summary

  • Add dbus method ConfigReload
  • Refactor cmdline parsing to account for multiple -conf values
  • Cleanup wayland output on deinit
  • Update tests and documentation
  • Add dunstctl reload and completions
  • Keep original notification state for reload

bynect avatar May 02 '24 16:05 bynect

@zappolowski it seems like the ci is having a problem with arch

maybe it's https://bbs.archlinux.org/viewtopic.php?id=276422?

bynect avatar May 02 '24 17:05 bynect

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 41.28440% with 128 lines in your changes missing coverage. Please review.

Project coverage is 65.37%. Comparing base (20033b8) to head (703bc5a). Report is 6 commits behind head on master.

Files Patch % Lines
src/rules.c 35.71% 63 Missing :warning:
src/dunst.c 0.00% 24 Missing :warning:
src/wayland/wl.c 0.00% 14 Missing :warning:
src/dbus.c 47.36% 10 Missing :warning:
src/queues.c 0.00% 9 Missing :warning:
src/option_parser.c 83.33% 3 Missing :warning:
src/settings.c 66.66% 3 Missing :warning:
src/draw.c 0.00% 1 Missing :warning:
test/icon-lookup.c 0.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1350      +/-   ##
==========================================
- Coverage   66.08%   65.37%   -0.72%     
==========================================
  Files          50       50              
  Lines        8247     8326      +79     
  Branches      958     1000      +42     
==========================================
- Hits         5450     5443       -7     
- Misses       2797     2883      +86     
Flag Coverage Δ
unittests 65.37% <41.28%> (-0.72%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 02 '24 19:05 codecov-commenter

mostly done. I'll do some more checks and maybe add a functional test

bynect avatar May 03 '24 22:05 bynect

Thanks for picking this up! I never got it to work properly when I tried it. But when the code is structured well, it should not be too hard to implement

fwsmit avatar May 06 '24 05:05 fwsmit

Thanks for picking this up! I never got it to work properly when I tried it. But when the code is structured well, it should not be too hard to implement

I made some updates. The only thing I am a bit unsure is the reapply of rules

bynect avatar May 07 '24 11:05 bynect

Basically I added a rule struct inside the notification that is allocated and filled when we try to apply a rule to change a value. Then when we reload we reapply that rule to "revert" the original state. it should work but I haven't tested much (it is kind of involved)

@fwsmit does this solve the problem you said in the comments?

bynect avatar May 28 '24 23:05 bynect

arch ci is not working ...

bynect avatar May 29 '24 09:05 bynect

@zappolowski I made the changes you suggested. Did you try hot reloading and found any problem? I wanted to merge this soon

bynect avatar Jul 01 '24 12:07 bynect

@fwsmit @zappolowski I finished. Also updated the docs. Can I merge this? wanted to release a version in this month what do you think?

bynect avatar Jul 10 '24 10:07 bynect

Looks good to me!

fwsmit avatar Jul 14 '24 14:07 fwsmit

I'll merge then

bynect avatar Jul 15 '24 09:07 bynect

seems like running dunstctl reload whilst a notification on screen causes dunst to stop working.

fxzzi avatar Sep 25 '24 21:09 fxzzi

seems like running dunstctl reload whilst a notification on screen causes dunst to stop working.

How so? It should just reapply the config to the notification

bynect avatar Sep 26 '24 07:09 bynect

dunstctl reload /home/dreuzzz/.cache/wal/dunst

Error org.freedesktop.DBus.Error.UnknownMethod: No such method “ConfigReload” Failed to communicate with dunst, is it running? Or maybe the version is outdated. You can try 'dunstctl debug' as a next debugging step.

Dreuzz avatar Sep 28 '24 22:09 Dreuzz

dunstctl reload /home/dreuzzz/.cache/wal/dunst

Error org.freedesktop.DBus.Error.UnknownMethod: No such method “ConfigReload” Failed to communicate with dunst, is it running? Or maybe the version is outdated. You can try 'dunstctl debug' as a next debugging step.

this means that the running version of dunst is not updated and doesn't have the reload patch.

bynect avatar Sep 29 '24 09:09 bynect

dunst -v

Dunst - A customizable and lightweight notification-daemon v1.11.0-76-gc1cc6d1 Compiled on 2024-09-29 with the following options: X11 support: enabled Wayland support: enabled SYSCONFDIR set to: /usr/local/etc/xdg Compiler flags: -g -std=gnu11 -pedantic -Wall -Wno-overlength-strings -Os -pthread -MMD -MP Linker flags: -lm -lrt -lgio-2.0 -lgdk_pixbuf-2.0 -lglib-2.0 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lharfbuzz -lcairo -lwayland-client -lwayland-cursor -lX11 -lXinerama -lXext -lXrandr -lXss

Dreuzz avatar Sep 29 '24 10:09 Dreuzz

dunst -v

Dunst - A customizable and lightweight notification-daemon v1.11.0-76-gc1cc6d1 Compiled on 2024-09-29 with the following options: X11 support: enabled Wayland support: enabled SYSCONFDIR set to: /usr/local/etc/xdg Compiler flags: -g -std=gnu11 -pedantic -Wall -Wno-overlength-strings -Os -pthread -MMD -MP Linker flags: -lm -lrt -lgio-2.0 -lgdk_pixbuf-2.0 -lglib-2.0 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lharfbuzz -lcairo -lwayland-client -lwayland-cursor -lX11 -lXinerama -lXext -lXrandr -lXss

you are using master branch right? You have to make sure that the program actually running is this one. sometimes the build systems/package managers start a different binary than the one in path

bynect avatar Sep 29 '24 12:09 bynect

On my Arch installation, dunstctl reload is not working:

[b1ack3ye@Black-PC ~]$ dunst -v
Dunst - A customizable and lightweight notification-daemon 1.11.0 (2024-04-15)
[b1ack3ye@Black-PC ~]$ dunstctl reload
dunstctl: unrecognized command 'reload'. Please consult the usage.
[b1ack3ye@Black-PC ~]$ dunstify "Test"
[b1ack3ye@Black-PC ~]$ dunstctl reload
dunstctl: unrecognized command 'reload'. Please consult the usage.

B1ack3ye avatar Oct 04 '24 19:10 B1ack3ye

@B1ack3ye this feature is not yet released. If you want to it you either have to build it yourself or use dunst-git from AUR.

zappolowski avatar Oct 05 '24 05:10 zappolowski

seems like running dunstctl reload whilst a notification on screen causes dunst to stop working.

How so? It should just reapply the config to the notification

yeah, which is what I'm thinking, however afterwards no notifications show up. For now I just pkill dunst and it starts itself up again next time a notification is sent.

fxzzi avatar Oct 05 '24 12:10 fxzzi

seems like running dunstctl reload whilst a notification on screen causes dunst to stop working.

How so? It should just reapply the config to the notification

yeah, which is what I'm thinking, however afterwards no notifications show up. For now I just pkill dunst and it starts itself up again next time a notification is sent.

do you mean when reloading all the notifications are closed? or when new notifications come nothing show up? it would be very helpful to provide a debug log (dunst -verbosity debug)

bynect avatar Oct 06 '24 13:10 bynect

do you mean when reloading all the notifications are closed? or when new notifications come nothing show up?

Both. current notifications close, and no new notifications show up.

it would be very helpful to provide a debug log (dunst -verbosity debug)

sure, here u go. https://paste.rs/xSpVi.txt

in this log, i simply launched dunst with verbosity, triggered my volume notification, and then did a dunstctl reload

fxzzi avatar Oct 06 '24 13:10 fxzzi

do you mean when reloading all the notifications are closed? or when new notifications come nothing show up?

Both. current notifications close, and no new notifications show up.

it would be very helpful to provide a debug log (dunst -verbosity debug)

sure, here u go. https://paste.rs/xSpVi.txt

in this log, i simply launched dunst with verbosity, triggered my volume notification, and then did a dunstctl reload

Are you using wayland right? Since I can only test on xorg maybe this is a wayland only bug. could you try using dunst in Xwayland mode to see if this works there?

bynect avatar Oct 06 '24 13:10 bynect

Are you using wayland right? Since I can only test on xorg maybe this is a wayland only bug. could you try using dunst in Xwayland mode to see if this works there?

yep, I'm running on wayland.

fxzzi avatar Oct 06 '24 17:10 fxzzi