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
tray: Embed in bar window #2609
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #2609 +/- ##
==========================================
- Coverage 13.17% 12.61% -0.56%
==========================================
Files 162 162
Lines 11509 12040 +531
==========================================
+ Hits 1516 1519 +3
- Misses 9993 10521 +528
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
patrick96
force-pushed
the
tray-child-window
branch
5 times, most recently
from
March 7, 2022 14:39
1c33be6
to
3008a72
Compare
patrick96
force-pushed
the
tray-child-window
branch
from
March 16, 2022 15:00
3008a72
to
1a4ad99
Compare
thank you for this! i can finally play full screen games without having the tray in the way 👍 |
patrick96
force-pushed
the
tray-child-window
branch
2 times, most recently
from
April 4, 2022 19:05
99bb0a5
to
9c6aca7
Compare
Currently requires a dirty workaround to prevent tray icons with different depths from crashing
The client window has to be added to the save set after it has been reparented. Otherwise if the reparenting fails weird stuff happens (windows in the save set have to be child windows of windows created by the current connection).
The wrapper window must define a border background if the depth doesn't match the parent window.
If an exception is thrown earlier, stopping the eventloop produces an error.
patrick96
force-pushed
the
tray-child-window
branch
from
April 15, 2022 22:18
cf7ca64
to
9ad73da
Compare
Not doign this. Using the desired background as the X window background color would require us to always first check before using the pixmap or cairo context.
They are noted in polybar#2689
Currently, we don't support 32-bit visuals and don't set _NET_SYSTEM_TRAY_VISUAL It is unclear what happens if the default visual (which is used as a fallback if _NET_SYSTEM_TRAY_VISUAL is not set) is 32-bit. In that case, we may need to explicitly use a 24-bit visual.
Unclear why it is needed, neither i3bar, nor stalonetray do delayed notifications
The border size was not taken into account when calculating the tray icon's y-position
patrick96
force-pushed
the
tray-child-window
branch
from
March 25, 2023 19:18
aa1fd8c
to
04fefa0
Compare
This was referenced Mar 25, 2023
Closed
nice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
This is the replacement for #1615 with a different approach.
Instead of trying to force the tray to somehow be a sibling of the bar window, we simply make the tray a child window of the main bar window. Then the tray should never appear in the wrong position or behind the bar or above fullscreen windows when the bar isn't.
There are still some issues. The main one is that if a tray client has a
ParentRelative
background and a different depth than the bar window, it can't be reparented:For now, I just remove the background pixmap from all tray clients for testing. However, in for this to be merged, we need to keep the pixmap set by the client.
TODOs:
tray-position
trays and reimplement the whole thing for modules. Allows us to make breaking changes.tray_client
XCB_MAP_NOTIFY
events delayed (when the next X event is received). Fixed in fix: Handle X events before polling for IO #2820Set_NET_SYSTEM_TRAY_VISUAL
Tray Window Background
Writing this down for later...
To get the proper background for the main tray window (background for the wrapper windows is something for later), we should be able to simply use a ParentRelative back pixmap.
However, currently the bar doesn't render anything in the place where the tray is (except for
tray-position = center
).To fix this, we have to also render the background in that excluded rectangle.
EDIT: This doesn't directly work because the bar window does not have a background pixmap. Every render cycle (and Expose event), it copies the pixmap into the window.
We may need to do something similar for the tray.
What we can do is use ParentRelative for the tray and run
xcb_clear_area
on the tray window (because that copies the pixmap from the bar window) whenever the bar window content updates.It seems it is not possible (or at least not using the usual tools) to create a transparent child window, even with a compositor.
EDIT2: We are now using pseudo-transparency (or a solid color) for each tray icon individually (each wrapper window has its own back pixmap).
We cannot easily use ParentRelative here since the depths may not match. An option would be to copy the appropriate regions of the bar pixmap into the wrapper pixmap on each render cycle.
Unsure how this plays with true transparency in the bar window.
Regarding Reparenting
When not using
_NET_SYSTEM_TRAY_VISUAL
and using a 32-bit visual, reparenting to the bar window (not the wrapper with appropriate depth) often fails. But if the visual is switched to 24-bit, reparenting seems to always work (also for windows with different depths).Setting the client pixmap to
ParentRelative
results in a BadMatch error for 32-bit clients even if the wrapper has the same depth and uses the same visual.The dropbox icons
The dropbox icon behaves weirdly. I'm guessing for some reason its background pixmap is undefined (that's why it sometimes contains image data from other tray icons).
When using a larger
tray-maxsize
, the background image seems to be only applied to a small square on the top-left.32-bit Visuals + Transparency
It seems we can't get
_NET_SYSTEM_TRAY_VISUAL
to work with a 32-bit visual without a ton of extra work. We basically need to redirect the client's window contents and then composite them over the bar's (or the wrapper window's) pixmap.For now, we should not set
_NET_SYSTEM_TRAY_VISUAL
and still only support pseudo-transparency for the tray.In case we want to do this in the future, this tutorial (wayback machine) seems to show the basics (using Xlib, but XCB has equivalent functions).
tint2
also seems to do this insystray_render_icon_composited
.Related Issues & Documents
Part of #2689
Closes #1615
Fixes #2433
Fixes #1537
Tray rendering issues:
It is unclear whether these are actually fixed. There are still some (seemingly unsolvable) problems with the dropbox icons
We should create a new issue where we collect applications that behave this way, maybe we can figure out what's causing this.
These issues should all be closed and redirected to the new issues in case the problem is still happening with the tray module:
TODO unlock issue #2933
Restacking Issues
Fixes #425
Fixes #789
Fixes #1995
Fixes #898
Fixes #1355
Fixes #2035
Fixes #2460
Fixes #2212 (Likely same issue as #2460)
References:
Documentation (check all applicable)
A complete set of doc changes will be made as part of finishing #2689