-
Notifications
You must be signed in to change notification settings - Fork 337
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 support for notification gaps #1053
Conversation
To support, two modifications were required. The first increases the size of the total image surface used by cairo so that the extra space required is not cropped. To calculate this, the gap size plus size of top and bottom border frames are summed for each notification. This is because normally only two frame widths are shown, but with gaps they are shown for each notification. The second simply increments the y offset by an additional value of the gap size. Each notification is also marked as both first and last to force both top and bottom frame borders to be drawn (if enabled).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting in the work to submit this and also for creating tests to keep it functional in the future. I've added a few comments mostly to simplify the implementation. If they turn out to be more complicated, let me know and I'll take a look at it.
Could you add the new settings to docs/dunst.5.pod
to include them in the man page?
Also, the tests are currently failing, because of a memory leak (might be in the test itself). Could you take a look at that as well. You can run the memleak test locally by running make test-valgrind
.
To avoid impacting other tests the global settings variable is restored at the end of each test. While slightly more repetitive than changing and restoring at the start the suite, this ensures the test handles its own cleanup. Basic formatting updates and an additional attempt to address pango valgrind errors were also added.
Thanks for the feedback, it definitely helped clean it up. The valgrind errors are due to the tests and are caused by In addition to |
Looks like the leak still occurs in at least
|
Looks like the issue is on debian's part, so go ahead and add it to the suppressions. |
Yeah seems like a good change. |
I added a suppression entry to target both As a side note, only the notification height is clickable and not the frame/border, which I think mirrors the previous logic in |
Well spotted. The reason that frames are currently ignored is mostly because the separator lines don't really belong to either notification and frames were just an extension of that. On second thought, I think it's best to have the frames and separator lines be clickable as well. Half of the separator line can be for the top notification and half can be for the bottom. If you want you can implement that, otherwise I'll make an issue for that.
Great! |
I updated the documentation and took a shot at updating the click handling logic for both gaps and separator lines, so let me know what you think. I added some tests in |
Thank you for your excellent work. Everything seems to work as intended. I'll go ahead and merge this! |
Any information on when this PR will make it into a release? :-) |
I can see a commit for 1.9.0, dated for |
Was also curious about this one myself |
I was working on a release with the intention of publishing that day, but a few tests failed, so I still have to fix those. I can probably fix them today |
It is now released! |
Just upgraded and tested, can confirm it works! Happy. Thank you! |
hey @fwsmit was this released for Fedora dnf yet? I updated the repos but still see 1.8.1-2 as the latest version:
|
That's up to the fedora maintainer. |
Summary
Provide gap support by adding option to draw blank spaces between notifications.
Related issues:
To support this feature, three general changes were required.
The first increases the size of the total image surface used by cairo so that extra space required by gaps does not crop notifications. To calculate this, the gap size plus size of top and bottom border frames are summed for each non top or bottom notification and added to the total height. This is because normally only the top and bottom frame widths are shown, but with gaps they are shown for each notification.
The second increments the y offset by an additional value of the gap size and extra frame widths. When gaps are enabled, each notification is treated as both first and last to reuse top and bottom frame borders draw logic.
Lastly, the click handling logic is updated to correctly associate y coordinates with the new notification positions when gaps are enabled.
To use:
Limitations/Potential Improvements
As mentioned in #1011 the gap areas are still drawn as "dead space" by cairo so any clicks on these areas do not pass down to applications below as a user may expect. Therefore this is only really suitable for small gap sizes where clicking between gaps to access applications below is not required. Additionally, like rounded corners and transparency, a compositor such as
picom
is required otherwise the gaps will show up as black space.I tried adding some unit tests in
test/draw.c
to target the logic withincalculate_dimensions
andlayout_render
but open to feedback on better ways to do this. Same goes for a functional test/demo undertest/functional-tests/test.sh
that usestest/functional-tests/dunstrc.gaps
where I also tried to added the option to test out click actions.I'm new to this project so let me know if there's anything I can change or improve on :)