elParaguayo / qtile-extras

Somewhere to store things I create for qtile that probably won't end up in the official repo
MIT License
163 stars 19 forks source link

Bar on a second monitor not working if reusing the same list of widgets #326

Closed MagnuSiwy closed 6 months ago

MagnuSiwy commented 6 months ago

Widgets get bugged if reused. The regular qtile bar let me use a list of widgets widgetsList which I could then use to create both of the bars. Example: mainScreenBar = bar.Bar(widgetsList, **barConfig) secondScreenBar = bar.Bar(widgetsList[0:x] + widgetsList[x + 3:], **barConfig) - I want to remove widgets from x to x+2 indecies from the second bar.

With qtile-extras widgets it is no longer possible. The bar on the second monitor breaks and the main bar widgets are not responding visually. I can still change the workspace by using GroupBox but it no longer changes the chosen group on the widget. Using a deepcopy() function from the copy library is not changing the behaviour.

Reddit post and screenshots

EDIT: Worth noting that the issue is not related to adding lists. My current config is working perfectly with that

elParaguayo commented 6 months ago

Thanks. I'll take a look when I can.

NB any widget that needs to have different behaviour depending on which screen it's displayed (e.g. GroupBox) should notbe mirrored, you should create a new instance for each screen. Mirrors just display the same contents as the original and pass button clicks to that widget rather than triggering their own behaviour.

MagnuSiwy commented 6 months ago

Good to know, thank you! I will change the config to avoid that. Unfortunately at the moment even if not mirroring the widgets that need to have different functionality it still doesn't work.

elParaguayo commented 6 months ago

I think it's your negative value Spacer widgets that are breaking this.

elParaguayo commented 6 months ago

Those widgets are not drawn in the original bar (as they only draw when the length is > 0) but I suspect they are taken into account when trying to position various other widgets.

However, the mirror widget has no check for the negative width value and so breaks.

I think this is actually an issue in main qtile.

elParaguayo commented 6 months ago

I think this fixes it: https://github.com/qtile/qtile/pull/4714

MagnuSiwy commented 6 months ago

Oh, I'm sorry then. That's true, I was testing it on qtile before I added those spacers, so it might be the main qtile issue after all. I added the negative values to "remove" the padding when the widgets are grouped and it worked perfectly with just the one bar. Actually it is breaking right after the calendar icon where the first spacer is.

Should I make an issue on main qtile? I don't think it's a bug then, I was just trying to "break the system". Is there any other way or maybe it's an idea for something to add to qtile, to separate padding_x or padding into padding for each of the sides?

elParaguayo commented 6 months ago

No need to apologise. It's good to spot the issue. I've submitted a PR to fix it so no need to open a new issue there (it would still be me dealing with it).

Ideally, it would be great if you could test that the fix works for you.

MagnuSiwy commented 6 months ago

I will try the changes tomorrow if that's not a problem. Will this affect the way the negative length works on the widgets? I still don't understand all of the code hah

Thank you for all of the help!

elParaguayo commented 6 months ago

No rush at all.

The fix I've submitted will preserve the behaviour of the negative length widgets.

elParaguayo commented 6 months ago

Ha. It's already been merged by another one of the devs so you just need to update to latest version of qtile.

MagnuSiwy commented 6 months ago

Oh boy, you work fast. Amazing!

MagnuSiwy commented 6 months ago

Ok, it works perfectly now. The only thing I can think of is that the checkupdates widget on the second screen has to refresh before the decorations start working. It's not really a problem, just something I noticed

elParaguayo commented 6 months ago

Interesting. I'll see if I can take a look later this week.