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

StatusNotifier in bar causing widget overlap #369

Closed rmcmilli closed 1 month ago

rmcmilli commented 1 month ago

When using StatusNotifier in the bar, my widgets overlap when widgets update like the previously drawn version doesn't get removed. The issue is the same in both x11 and wayland.

When using Systray: qtile-tray-normal

When using StatusNotifier:

qtile-status-overlapped

Qtile.log output

                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/widget/base.py", line 609, in calculate_length
    return min(self.layout.width, self.bar.width) + self.actual_padding * 2
               ^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/backend/base/drawer.py", line 429, in width
    return self.layout.get_pixel_size()[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/pangocffi.py", line 134, in get_pixel_size
    pango.pango_layout_get_pixel_size(self._pointer, width, height)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2024-07-29 21:10:07,207 ERROR libqtile manager.py:_finalize_configurables():L327 exception during finalize
Traceback (most recent call last):
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/hook.py", line 150, in _subscribe
    lst.remove(func)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/core/manager.py", line 315, in _finalize_configurables
    widget.finalize()
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/widget/windowname.py", line 107, in finalize
    self.remove_hooks()
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/widget/windowname.py", line 69, in remove_hooks
    hook.unsubscribe.client_name_updated(self.hook_response)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/hook.py", line 123, in _hook_func
    return self._subscribe(hook.name, func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/hook.py", line 152, in _subscribe
    raise utils.QtileError(
libqtile.utils.QtileError: Tried to unsubscribe a hook that was not currently subscribed
2024-07-29 21:10:07,231 WARNING libqtile manager.py:grab_key():L503 Key spec duplicated, overriding previous: <Key (['mod4', 'shift'], T)>
2024-07-29 21:10:07,257 WARNING libqtile base.py:__getattr__():L271 Deprecation Warning: commands exposed via IPC no longer use the 'cmd_' prefix. Please replace 'cmd_spawn' with 'spawn' in your code.
2024-07-29 21:10:07,341 ERROR libqtile loop.py:_handle_exception():L62 Exception in event loop:
Traceback (most recent call last):
  File "/usr/lib64/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/core/manager.py", line 973, in f
    func(*args)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 620, in _actual_draw
    self._resize(self._length, self.widgets)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 463, in _resize
    stretchspace = length - sum(i.length for i in widgets if i.length_type != STRETCH)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 463, in <genexpr>
    stretchspace = length - sum(i.length for i in widgets if i.length_type != STRETCH)
                                ^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/qtile_extras/widget/decorations.py", line 879, in length_get
    length = int(self.calculate_length())
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/widget/base.py", line 609, in calculate_length
    return min(self.layout.width, self.bar.width) + self.actual_padding * 2
               ^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/backend/base/drawer.py", line 429, in width
    return self.layout.get_pixel_size()[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/pangocffi.py", line 134, in get_pixel_size
    pango.pango_layout_get_pixel_size(self._pointer, width, height)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2024-07-29 21:10:07,598 ERROR libqtile loop.py:_handle_exception():L62 Exception in event loop:
Traceback (most recent call last):
  File "/usr/lib64/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/core/manager.py", line 973, in f
    func(*args)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 620, in _actual_draw
    self._resize(self._length, self.widgets)
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 463, in _resize
    stretchspace = length - sum(i.length for i in widgets if i.length_type != STRETCH)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/bar.py", line 463, in <genexpr>
    stretchspace = length - sum(i.length for i in widgets if i.length_type != STRETCH)
                                ^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/qtile_extras/widget/decorations.py", line 879, in length_get
    length = int(self.calculate_length())
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/widget/base.py", line 609, in calculate_length
    return min(self.layout.width, self.bar.width) + self.actual_padding * 2
               ^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/backend/base/drawer.py", line 429, in width
    return self.layout.get_pixel_size()[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmilli/.local/lib/python3.12/site-packages/libqtile/pangocffi.py", line 134, in get_pixel_size
    pango.pango_layout_get_pixel_size(self._pointer, width, height)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType

qtile-issue.log

Admittedly my config.py is a bit of a mess: config.py.txt

elParaguayo commented 1 month ago

Does this happen with the StatusNotifierfrom qtile?

rmcmilli commented 1 month ago

I'm running the GitHub version of qtile so I assumed I needed to have qtile-extras. Without qtile-extras I get an import error

Sent from a mobile device, please excuse my brevity


From: elParaguayo @.> Sent: Monday, July 29, 2024 11:45:45 PM To: elParaguayo/qtile-extras @.> Cc: rmcmilli @.>; Author @.> Subject: Re: [elParaguayo/qtile-extras] StatusNotifier in bar causing widget overlap (Issue #369)

Does this happen with the StatusNotifierfrom qtile?

— Reply to this email directly, view it on GitHubhttps://github.com/elParaguayo/qtile-extras/issues/369#issuecomment-2257451942, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFJPJPPIEEUO2LUVGOM2NLZO4K7TAVCNFSM6AAAAABLVNMGBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJXGQ2TCOJUGI. You are receiving this because you authored the thread.Message ID: @.***>

rmcmilli commented 1 month ago

Okay, so I commented out all references to qtile-extras and it looks like it works fine. image

elParaguayo commented 1 month ago

That's odd as the qtile-extras version doesn't do anything extra with the icons, it just adds the menu support.

What about if you use the qtile-extras version but comment out the decorations. Do you see still see the same issue?

rmcmilli commented 1 month ago

I will try it later today when I'm back at that machine. Oddly, I have the same decorations with the same version of qtile and qtile-extras on another machine that works without issue. Both machines are running Fedora 40.

config.py.fine.txt

elParaguayo commented 1 month ago

That is odd. Does it only happen with certain apps?

rmcmilli commented 1 month ago

No, I only use the same 4 apps in the bar. kde-connect-indicator,blueman-indicator,Remmina,nextcloud (desktop client). All seem to render correctly on the one setup.

rmcmilli commented 1 month ago

Confirmed no change when decorations are removed on wayland.

The biggest changes between the config files are the groupbox.visible_groups and groupbox.bar.draw sections in screen_reconf(). When loading qtile I get a clear bar initially, then it redraws to include the StatusNotifier icons but doesn't remove the previous bar and they stack.

elParaguayo commented 1 month ago

Yeah - I'm not convinced this is a StatusNotifier issue, it looks like your bar isn't being redrawn fully when it needs to be.

However, that config is way too much for me for me to go through to find the source of the issue. Ideally, we need a minimal config that reproduces the issue i.e. start from the default config and then add bits step by step, checking each time if the issue arises e.g.:

rmcmilli commented 1 month ago

Okay, so after rebooting the other machine without the screen_reconf function it is actually misbehaving on both. The second file I posted config.py.fine is considerably smaller but I will try to walk through removing things.

rmcmilli commented 1 month ago

New bit of logging:

2024-07-31 11:31:45,496 ERROR libqtile manager.py:_finalize_configurables():L327 exception during finalize
Traceback (most recent call last):
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/core/manager.py", line 315, in _finalize_configurables
    widget.finalize()
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/widget/statusnotifier.py", line 159, in finalize
    host.unregister_callbacks(
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/widget/helpers/status_notifier/statusnotifier.py", line 670, in unregister_callbacks
    self._on_item_added.remove(on_item_added)
ValueError: list.remove(x): x not in list
2024-07-31 11:32:02,042 ERROR libqtile manager.py:_finalize_configurables():L327 exception during finalize
Traceback (most recent call last):
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/hook.py", line 150, in _subscribe
    lst.remove(func)
ValueError: list.remove(x): x not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/core/manager.py", line 315, in _finalize_configurables
    widget.finalize()
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/widget/windowname.py", line 107, in finalize
    self.remove_hooks()
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/widget/windowname.py", line 69, in remove_hooks
    hook.unsubscribe.client_name_updated(self.hook_response)
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/hook.py", line 123, in _hook_func
    return self._subscribe(hook.name, func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmcmillian/.local/lib/python3.12/site-packages/libqtile/hook.py", line 152, in _subscribe
    raise utils.QtileError(
libqtile.utils.QtileError: Tried to unsubscribe a hook that was not currently subscribed
rmcmilli commented 1 month ago

For now, rolling back to 0.26.0 works.

elParaguayo commented 1 month ago

OK - so it looks like it's that finalisation code that's causing the issue.

rmcmilli commented 1 month ago

Removing the opacity setting and transparency from the bar seems to have worked around it visually. Adding either causes issues on reload of qtile.

It does seem the the previously spawned drawers are still present, as the CPU usage of the qtile process seems to increase with every reload.

elParaguayo commented 1 month ago

Yeah. There's definitely a bug there. I'm looking at that separately so let's pause here and I'll let you know when I have fixed the drawer issue.

elParaguayo commented 1 month ago

Can you try the fix in qtile/qtile#4955

rmcmilli commented 1 month ago

Transparent bar works much better now. Looks like it should and CPU looks right. Looks like I even got a new icon for nm-applet.

Wayland did have a few issues so I'm monitoring that presently.

rmcmilli commented 1 month ago

I'm seeing significant issues with libinput/wlroots with the fix. Particularly on boot and after resume from suspend. Seeing errors like Your system is too slow coming from libinput/wlroots that I don't see at all with the previous code.

Power and CPU usage is much improved with the fix. Rolling back to 0.27.0 without transparency for now.

elParaguayo commented 1 month ago

Is it definitely caused by that patch? There's absolutely no reason for that to have any impact.

There have been some other changes merged into qtile recently too. Could it be any of those?

rmcmilli commented 1 month ago

I can try to step through the recent patches and see where it pops up but it'll take a bit.

elParaguayo commented 1 month ago

...and v0.28.0 has just been released.

elParaguayo commented 1 month ago

Thanks. I'm really struggling to see how it's the widget code.

rmcmilli commented 1 month ago

After installing the 0.28.0 update and rebooting, things looks to have stabilized. StatusNotifier looks okay now. Thanks!