Skip to content
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

[WIP] Fix tray restacking issues #1615

Closed
wants to merge 2 commits into from

Conversation

patrick96
Copy link
Member

@patrick96 patrick96 commented Jan 19, 2019

EDIT: Maybe it's a better idea to just make the tray window a child window of polybar. Then repositioning should get a lot easier.
Alternatively, have a main window and have the bar and the tray as two separate child windows.


The restacking issues observed in #1355 and #425 is caused by the WM reparenting the polybar window but not the tray window when override-redirect = false. Because of this the two windows are no longer siblings, causing the XCB_MATCH error.

Automatic reparenting causes problems with tray-offset-* not being applied in at least openbox and maybe other WMs. The reason for that is that openbox reparents the bar window into a window that hast the same dimensions as the bar window, if we also move the tray under that window, the tray cannot be drawn outside of the bar bounds. My solution here is a somewhat breaking change because by default reparenting is turned on. I think this is fine because it's only a breaking change in WMs that make the bar a child of a window with tight bounds and in configs that use the tray offset to move the tray outside of the bar's bounds. There is no other way to fix two linked issues in those WMs.

To not totally break people's configs that may want to move the tray outside of the bar bounds on those WMs, I have introduced a new key in the bar section:

; Make sure that the bar and tray windows are siblings
; This option generally doesn't need to be modified unless you have issues with
; the tray offset not working.
; If set to false, you may get `tray: Failed to put tray above ...` errors and
; the tray may appear on top of fullscreen windows.
tray-reparent = true

Fixes #1355
Fixes #425
Fixes #1813
Fixes #1995

This fix could also work for #898
This fix could also work for #2460
This fix could also work for #2433
This fix could also work for #1995
This fix could also work for #789
This fix could also work for #1537
Closes #1657
Fixes #2035

WMs like i3 and openbox reparent the bar window when override-redirect
is false, because of that the restacking of the tray window often didn't
work.

This should basically eliminate "Failed to put tray above..." errors.

Fixes polybar#425
Fixes polybar#1355
Introduces `tray-reparent = true` in the bar section

Reparenting may impede our ability to use the tray offset values to
their fullest extent. For example in dropbox, the bar parent window is a
window with the exact same dimensions, so if the tray becomes a child of
that window, we cannot get the tray to draw outside of those bounds as
we could before.
This was referenced Jan 19, 2019
@patrick96 patrick96 changed the title Fix tray restacking issues [WIP] Fix tray restacking issues Jan 19, 2019
@patrick96
Copy link
Member Author

Dang, just found some issues when bar offset is used ☹️

@patrick96 patrick96 removed the request for review from NBonaparte January 20, 2019 09:38
@patrick96 patrick96 added this to the 3.4.0 milestone Feb 11, 2019
@patrick96 patrick96 modified the milestones: 3.4.0, 3.5.0 Jun 28, 2019
@ardadem
Copy link

ardadem commented Jul 26, 2019

Is this works well without bar offset?

@patrick96
Copy link
Member Author

Is this works well without bar offset?

It should. I have not seen any issues in my testing.

@im-n1
Copy link

im-n1 commented Nov 27, 2019

How is this still pending? It's related to #425 which is a long going issue. Still active issue.

@patrick96
Copy link
Member Author

@im-n1 It requires me to rewrite all the code that handles tray positioning (which is most of the tray code) and I don't really have time for that right now. Feel free to add changes to this PR if you have the time to rewrite the tray coordinate handling.

@im-n1
Copy link

im-n1 commented Nov 27, 2019

Okay, seems reasonable. I would like to help but C++ is not my thing.

@mushi-nova
Copy link

mushi-nova commented Aug 2, 2020

Since you mentioned in this thread that it solves the issue but I'm still getting the error of
error: tray: Failed to put tray above 0x6e00001 in the stack (XCB_MATCH (8))
even though I have the following things inserted in my polybar config
tray-reparent = true

And the system tray icons are missing in it. I tried a combination of
wm-restack = i3 override-redirect = true
but it didn't solve anything rather it distorted the whole polybar.

@veksha
Copy link

veksha commented Aug 29, 2020

i had a problem when tray was on top of my fullscreen applications. thank you for this changes. now it works fine for me. (i use openbox.)

@ngmoviedo
Copy link

On i3-gaps, the tray stays over floating windows while the rest of the bar is set to stay behind, even with tray-reparent = true. It sometimes stays on top of i3lock, but that's the only fullscreen application where I've seen the behaviour. I've also tried combinations of wm-restack and override-redirect, to no avail. This behaviour is not new, but is not solved by this pull request and I guess it might be within its scope or may interest someone.

@patrick96 patrick96 marked this pull request as draft January 11, 2021 08:25
@JimPix1
Copy link

JimPix1 commented Mar 2, 2021

I've had this problem for so long and it's annoyed me so much I've made a github account just to comment here. I added the tray-reparent section to the polybar config to no avail, i've done fiddling to try and fix it to no avail. It doesn't occur in fullscreen but it occurs when a floating window goes over it or the i3-msgbar appears on top. This has been a bug for 4 years and it's a really annoying one, can this please be fixed?

@patrick96 patrick96 added this to the 3.7.0 milestone Mar 2, 2021
@patrick96
Copy link
Member Author

@JimPix1 Did you compile this PR and it still doesn't work?

@JimPix1
Copy link

JimPix1 commented Mar 3, 2021

@JimPix1 Did you compile this PR and it still doesn't work?

I didn't compile anything, what do you mean by PR?

@patrick96
Copy link
Member Author

You mentioned tray-reparent and I thought you were saying that the changes I made in this pull-request (PR) did not fix your issue. But it seems you are using a regular polybar release.

@JimPix1
Copy link

JimPix1 commented Mar 3, 2021

You mentioned tray-reparent and I thought you were saying that the changes I made in this pull-request (PR) did not fix your issue. But it seems you are using a regular polybar release.

Oh, I just added that section to my config..that's not the correct way to get it working?

@patrick96
Copy link
Member Author

This pull request contains the work-in-progress changes to fix the bug, it is not yet part of the code or part of a release, that's why it's not fixed yet. You can try out the fix, by compiling this pull-request, but you will have an outdated polybar. Also, you shouldn't need tray-reparent anyway because setting it to true will restore the old broken behavior.

@JimPix1
Copy link

JimPix1 commented Mar 3, 2021

So how would I fix it? This has happened to me since I first got polybar, from mint to arco, is tray-reparent doesnt fix it what will?

@patrick96
Copy link
Member Author

The changes in this pull-request are the fix. They're not finished yet, but they should work in most cases (unless you use offset-x or offset-y).

@JimPix1
Copy link

JimPix1 commented Mar 3, 2021

So how do I add these changes?

@ndavd
Copy link

ndavd commented Apr 22, 2021

Guess I'll use polybar once this get merged...

@patrick96 patrick96 mentioned this pull request Feb 17, 2022
11 tasks
@patrick96 patrick96 mentioned this pull request Feb 27, 2022
27 tasks
@anhnamtran
Copy link
Contributor

Is this PR still active given the existence of #2595 and #2609 ? I'm planning to clone this locally to get around #1813 but I don't know if I should be using either of the other PRs instead, since they seem to be more active.

@patrick96
Copy link
Member Author

@anhnamtran #2609 effectively replaces this PR. I think it's the better approach than to forcefully reparent the tray window.

#2595 only creates a module that can display the tray, it doesn't fix any existing tray issues (not even the ones where the tray is positioned in the wrong place).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants