-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
Transparency in X11 and Wayland #2513
Conversation
62308ce
to
d0f47dd
Compare
Nice. Can you please share the to do list? Maybe you could get some help. :) |
Hopefully it's just a case of testing now. I thought that the systray may be a problematic because that seemed to be an issue when frostidaho originally worked on this. It may be working now by my sheer dumb luck! |
The Wayland Do we need to make the depth configurable? Perhaps we could try to use 32bit but Could you elaborate on the custom colormap stuff and the issues with RecordingSurface? Just so I understand what's going on :) |
Just seen #2508 (comment) which helped. What does |
Well, it didn't work when I tried it but I don't know if I've got Wayland working or not (got a solid magenta background when I started it).
Currently, you can set the depth for the bar but, other than that, the changes default to requesting 32 bit windows for internal windows. It should fallback to root visual if 32 bit isn't available.
Custom colormap was shamelessly copied from frostidaho's work (#1059 (comment)). As for the issue with the qtile/libqtile/backend/x11/drawer.py Lines 189 to 194 in d0f47dd
|
Ah - our posts overlapped. This page is good at explaining the operators but, in short, I haven't tested more but it seems that In case it's not obvious, there's no issue when using opaque surfaces because |
The magenta is actually currently the default "you have no background set" colour, which I was using to help with damage tracking because it's so high contrast :p I should probably change that to black like the X server.... As for
OK thanks, think I'm following now.
IIRC RecordingSurfaces were introduced so that the underlying pixmaps can be resized (i.e. destroyed and then replaced with different one) while keeping the drawing operations around and usable across pixmaps. Maybe we could find an alternative solution for that, otherwise we'll have to figure out a way to accomplish using alpha while continuing to use RecordingSurfaces. |
Good to know. I would like to inlcude Wayland in this PR if I can (will need to rename it...) and it sounds like it might be easy to do so I'll add to the list at the top.
As far as I can tell, it's only going to be an issue when we need to clear the background which should be solved by my updated |
This comment has been minimized.
This comment has been minimized.
Will do. Although I was thinking of more "hands-on" tests and seeing if things still display properly. A test script won't necessarily do that. |
Very cool. What differences are you seeing? |
If you look at the left-hand side you can see that the layout icon is transparent and shows the bar colour in x11 but, in wayland, you see the wallpaper instead. x11 is correct here. However, also in x11, the group box has lines underneath the inactive groups whereas wayland doesn't. wayland is correct on this. EDIT: solved the first one, just the second to go... EDIT 2: second one is an issue with the widget itself. If the line colour isn't set for inactive groups then it draws the line with the background colour. However, where you've got semi-opaque backgrounds, drawing this colour on top of itself makes it darker because the draw blends in overlay mode. |
Nice, nice. re to do list entry |
To be very honest: that's a typo. I was thinking about checking multiple widgets (as in I want to check whether transparency threw out any issues in individual widgets, like the GroupBox in my earlier post). I was also thinking about the system tray as that had been flagged earlier as not working with transparency. My brain just squashed those ideas together! |
Lol fair. The systray is an interesting case because the pixels are provided by clients. Should transparency even apply to its icons? |
Systray is one of the widgets I'm least familiar with but I plan to look at it later today as it's crashing on wayland at the moment but I suspect that's a quick fix. Once it's running I can then test the transparency point. In terms of your question, I would hope that the icons are in 32 bit windows so transparency is available to them. That seems to be the case with one of my earlier screenshots showing vlc in the tray but I haven't dug in to the code to see how it all fits together. |
I could be wrong, but my understanding of the systray is that it is inherently tied to X (https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html), and therefore will never work under Wayland. For this reason I haven't looked at it at all as part of the wayland work. However, that is not to say that a system tray cannot be used under Wayland, it would just use a different protocol, e.g. https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/ which is what Swaybar uses. |
Good to know. So my Can look at making a wayland systray another time. |
Good to know. So my `quick fix` will be to remove it from my wayland config!
:D yep!
…On 210609 03:35, elParaguayo wrote:
Good to know. So my `quick fix` will be to remove it from my wayland config!
Can look at making a wayland systray another time.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#2513 (comment)
|
I think the bug has something to do with this error in the logs:
I don't get this when the bar's window depth is set to 24 bit so I'm assuming that there's some mismatch between the bar and the SysTray in terms of the depth or visual but I'm having difficulties tracing it down. |
Anything interesting here? https://github.com/polybar/polybar/blob/master/src/x11/tray_manager.cpp |
Certainly some interesting bits in there but there's also this:
|
How will that affect what you're doing? |
Almost got the Can't immediately see where I've gone wrong and why it's working on wayland... @m-col would be good if you could take a look at some point. EDIT: looks like I need to rebase onto master but will do this once we've fixed this bug. |
624d934
to
a169709
Compare
This comment has been minimized.
This comment has been minimized.
b2500ab
to
0afe403
Compare
In X11 backends, transparency will be disabled in a bar if the ``background`` | ||
color is fully opaque. | ||
|
||
|
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.
Maybe add a note about Systray?
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.
I added a SysTray comment in its own docstring so it's visible on the Widgets page.
ddd0569
to
5007ddf
Compare
The only issue I have is that the very first draw of mirror widgets (or, at least, mirrors of the CPUGraph widget) appear as black and then subsequent draws show what they are meant to. It's a small issue, but fixing it would make this "complete" IMO. If fixing that is not straight forward, I'd rather this PR be in the next rlease as is than not at all. |
Great - let me take a look at that. EDIT: Interesting. It's Wayland only... EDIT 2: Think I've fixed it. Just need to rebase. |
This PR adds 32-bit colour depth for X11 which allows transparent windows (e.g. the bar). This is based on the work of frostidaho from a number of years ago. The PR also makes some changes to the Wayland backend to enable rendering of transparent windows.
This PR fixes rendering issues in widgets related to the use of transparent backgrounds. SysTray: Only works on fully transparent backgrounds. GroupBox and TaskList: fixes issues when background is semi-transparent.
The SysTray widget will not display correctly with a solid background in a 32-bit window. We therefore set the bar's window depth to 24-bit if the user requests a fully opaque bar.
libqtile/backend/wayland/drawer.py
Outdated
rect_changed = current_rect != self.previous_rect | ||
|
||
# Check if draw has content (would be False for completely transparent drawer) | ||
ink_changed = any(not math.isclose(0.0, i) for i in self.surface.ink_extents()) |
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.
It's interesting that ink_extents
doesn't take into account transparent painted things. I'm guessing you checked this before doing it this way? I'd have expected them to be handled in the same way as things without 100% transparency.
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.
Correct. Anything with 100% transparency doesn't register with ink_extents()
. However, I think that makes sense as, if it's fully transparent, there's nothing to draw.
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.
Great! Everything looks good to me, so if there is nothing left you had in mind to change then I guess this is ready for merge 🎉
It's light on tests (just checking some additional utilities) but, other than that, there's nothing more that I think needs to be added here. |
This PR adds 32-bit colour depth for X11 which allows transparent windows (e.g. the bar). This PR aims to address some existing issues (#900, #1320, #1722, #1934 and probably some others) but will need more work before it can be merged. I'm uploading it now in case people want to test it.
It does look pretty good though:
There's a discussion about getting transparency to work here: #2508
This is based on the work of frostidaho from a number of years ago - so big kudos to them for doing most of the legwork.
I'm assuming the system tray will be an issue so I'll look at that next...
Wayland would also need to be looked at separately.
EDIT: systray may be ok:
EDIT 2: To do list