-
Notifications
You must be signed in to change notification settings - Fork 348
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 wayland support #781
Add wayland support #781
Conversation
I think the proper way to fix the wayland mouse interactions would be to add a wayland source to the mainloop (just like https://github.com/sardemff7/libgwater/blob/master/wayland/libgwater-wayland.c |
Thanks, that looks like a good solution! I'm not sure how the maintainers feel about adding this as a dependency. It won't be too hard to implement with this as a reference either. |
I implemented it. Works well. |
Looking good!
Since you're going with the 'one big PR in one go' strategy feel free to work on your branch until you feel you've reached a sufficient milestone to merge this into master, I'll do a full review then (perhaps consider marking the PR as draft until then).
It looks like that library isn't packaged in Debian and I'd assume other distros so for that alone I'd hesitate adding it as a dependency, given that it's only a ~200 line file, I'm ok with embedding it. |
I've converted it to a draft.
In the linked repository they recommend to use it as a git submodule, but I think it's easier to embed it as well. |
1775cfb
to
a605259
Compare
Codecov Report
@@ Coverage Diff @@
## master #781 +/- ##
==========================================
- Coverage 65.01% 59.48% -5.53%
==========================================
Files 30 36 +6
Lines 5276 5798 +522
==========================================
+ Hits 3430 3449 +19
- Misses 1846 2349 +503
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
8cc135b
to
7747de0
Compare
288c0e6
to
5f1c7e4
Compare
This PR is now ready for review. The wayland output has almost all of the features of the X11 output. One notable exception is that the wayland version cannot detect fullscreen, thus cannot show only some notifications in fullscreen. Here is a summary of the changes in other places:
Edit: There is still one bug that I know of. The input region isn't updated when a notification is clicked away. Only when you move your mouse it's updated again. According to the docs, the input region should resize with the surface. I also tried manually updating the input region (mako does that as well), but that didn't work either. It's not a very important bug, so it can be solved later. |
I bisected it, and the bug was introduced by ed1e3a8 which applies a fix from master. I'm not sure why it works on wayland and X11, but not on Xwayland. |
Try out https://github.com/tsipinakis/dunst/tree/action-fix, a better fix for the same bug. Is the issue still present there? |
I tried it out on wayland, and I didn't see any issues. I'll rebase onto that branch when it is in master. |
I've pushed the updated fix to master, please rebase when possible. |
Thanks, I've rebased ( or rather merged) onto master. This doesn't fix the issue on xwayland right away (flickering when clicking on notification and notifications not disapearing). |
Could you elaborate on that? I have compared the wayland and Xwayland versions and the wayland version for me seems way better. Try replacing a long notification with a short one. I believe on Xwayland, you will resize artifacts, while on wayland it's perfect. |
Well, I used dunst in combination with xwayland for about a month. It wasn't a nice experience, but it worked some way. Now using it with native wayland, there didn't stick out any big improvements. I still feel pain points one thing, that the window opens on the wrong output. It doesn't open anymore on the same monitor, but it's not well aligned. But please don't count on me here. I'm a sway user for one month now. I do not understand all concepts of wayland yet and maybe these settings have to be done in sway somewhere. |
So if I understand correctly, the dunst window opens on the wrong output and is positioned incorrectly on that output? Looking at your dotfiles it seems like you have
Note that on wayland the bottom is somehow counted from the top of your status bar (if your status bar is at the bottom). So if you want the notification to appear at the same place as on X11, you might have to subtract the status bar height from that. Now that I think of it, it's probably good to document that. The follow part I don't understand why it's not working. You will have to give more info about that. |
Another thing to note, I recently discovered there is a wayland protocol for detecting if there is a fullscreen window. I will hopefully implement that protocol for dunst soon, but that will mean that the |
Also added some more documentation.
Because idle detection on xwayland is not possible, just assume that the user is not idle. This also somehow fixes notifications not disapearing when clicking on them.
This can be changed in config.mk or by using the command make WAYLAND=0 Also removed using_xwayland function definition as it isn't defined anymore
@tsipinakis Do you have time to look at this PR? |
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.
Well, I used dunst in combination with xwayland for about a month. It wasn't a nice experience, but it worked some way.
Now using it with native wayland, there didn't stick out any big improvements. I still feel pain points one thing, that the window opens on the wrong output. It doesn't open anymore on the same monitor, but it's not well aligned.
Native support is always better than going through the translation layer. Especially since it looks like most distros are moving away from X11.
Now, some pain points might still be there but they can be fixed with later iterations.
Sorry for the delay in this, I've been a bit busier than I expected lately. This is ready for a merge. Just a tiny log nitpick I noticed when scanning the code for a final pass ;)
No problem. Thanks for reviewing the code. It should be good to go now. |
Thanks again @fwsmit, that's an insane amount of work you did here! Merged! |
Add wayland support
While mako has the more straight-forward config and better out-of-the-box looks, it's missing some killer features: 1. easy silent toggling - mako's mode solution is subpar IMHO and does not allow for easy toggle compared to dunstctl's `set-paused toggle` 2. no easy counting of "waiting" notifications, need to manually parse JSON history compared to `dunstctl count waiting` 3. worst of all, it does not show silenced messages after unsetting silent mode and can only show latest hidden message via `makoctl restore` (though iteratively). dunst just unhides ALL previously paused notifications! Dunst supports Wayland since dunst-project/dunst#781, so no need to sick with mako or even swaync.
While mako has the more straight-forward config and better out-of-the-box looks, it's missing some killer features: 1. easy silent toggling - mako's mode solution is subpar IMHO and does not allow for easy toggle compared to dunstctl's `set-paused toggle` 2. no easy counting of "waiting" notifications, need to manually parse JSON history compared to `dunstctl count waiting` 3. worst of all, it does not show silenced messages after unsetting silent mode and can only show latest hidden message via `makoctl restore` (though iteratively). dunst just unhides ALL previously paused notifications! Dunst supports Wayland since dunst-project/dunst#781, so no need to stick with mako or even swaync.
Don't merge this in master yet, it's probably best to put this on a separate branch first.
Thanks to a lot of code from the old wayland branch and from mako, I improved dunst's wayland support.
It now handles mouse input well. This is done in a hacky way by making the sleep in the main loop shorter. I noticed that otherwise the input was only handled when the sleep was over. I'm not sure what the right way to do this is.
The second improvement is the positioning of the notification. Instead of putting the notification at the edge of the screen, it's positioned using zwlr_layer_surface_v1_set_anchor and using some margin. This will probably not work on non-wayland compositors, but I haven't tested that yet.
And thirdly, the Makefile now builds, so that's good. I also made sure to autogenerate the protocol headers with wayland-scanner, so they always stay up-to-date.
These are the things that have to be done, before this can be considered to be merged in master: