[BUG] Systray doesn't update icons properly
Closed this issue · 9 comments
Checklist before submitting an issue
- I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
- I have specifically verified that this bug is not a common user error
- I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)
Description of the bug
The systray widget doesn't update when an app updates it systray icon. For example nextcloud will show its initial icon only, but not the "sync complete" icon. Only after closing and opening the bar that contains the systray it will show the updated icon.
When launching my WM (Hyprland) which launches eww under the hood, initially no systray icons are shown. Only after closing and opening the eww bar, it shows the correct systray icons. This leads me to believe something is amiss in the process that receives updates on systray icons.
Reproducing the issue
Add a simple systray widget:
(systray :icon-size 16 :spacing 12 :space-evenly "true" :prepend-new "true")
eww open bar_1
Launch nextcloud-client or any other app that updates its systray icon. Observe the new icon not being shown in the eww bar until after you close and open the eww bar.
or
Launch eww from your startup configuration and observe systray icons of apps that are also auto launched from your startup configuration not being shown until after you close and open the eww bar.
Expected behaviour
Expect an accurate state of all systray icons.
Additional context
I run eww from git:
eww 0.6.0 6db0f95
This is confirmed and seems to be related to the pretty messed-up update-zbus commit. There are multiple breakages that this update caused, including #1180, #1181 and #1202 and your finding. Systray icons updated flawlessly up-to the update-zbus commit. @w-lfchen I think this update (and all its dependencies) should really be fully reverted and thoroughly tested locally before re-introducing it.
the commit link is broken, but you're probably referring to 71ba502.
#1202 is not related to it.
#1170 is currently the only issue linked directly to the commit, and it has been fixed by #1181.
#1180 has not been confirmed to be directly linked to the zbus update; the discussion in #1180 was related to #1170.
i'll look into reverting to zbus 3.x.x, but the update to 4.x.x should really happen at some point
opened #1203, i have yet to find an easy way to reproduce this so please test it throughly
the commit link is broken, but you're probably referring to 71ba502.
Fixed. Sorry about that.
i'll look into reverting to zbus 3.x.x, but the update to 4.x.x should really happen at some point
Absolutely.
i'm glad, can you give me a way to reproduce it
You need to use an application that updates its icon. I first discovered the issue with birdtray (a systray wrapper for thunderbird). Birdtray would setup a systray thunderbird icon with a red "X" on it while it starts thunderbird in the background, then update the icon to be without the "X" once thunderbird is running. It would also change the icon once thuderbird gets new email. After the zbus 4 update, the icon with the red "X" would never go away or change (making birdtray practically useless).
Another, probably easier, way to see the issue is Nextcloud Desktop client. You need to setup folder sync using the Nextcloud Desktop client. Now shut down the client, then start it again. The client posts a systray white icon with "..." while it syncs with the remote service. Once sync is done (usually takes a few seconds), the icon will change to a check-mark. With zbus 4 the check-mark icon never appears. You can signup for a free Nextcloud account at: https://nextcloud.com/sign-up/ and get the client from your distro.
Easiest to reproduce/test if you have Python installed on your system, install the pystray module, then use the following trivial code:
import pystray
import threading
import time
from PIL import Image
def update_icon():
img1 = Image.new("RGB", (32, 32), (0, 255, 0))
img2 = Image.new("RGB", (32, 32), (255, 0, 0))
while True:
icon.icon = img1
time.sleep(1)
icon.icon = img2
time.sleep(1)
if __name__ == "__main__":
icon = pystray.Icon("testicon")
thread = threading.Thread(target=update_icon)
thread.start()
icon.run()
On a properly working systray the above code will draw a 32x32 icon on systray and update it to change between green and red every second. On the zbus 4 version this program breaks.
sorry for taking my time responding to this, i was occupied by my personal life.
thank you so much for that simple script!
i'll use it for testing once i work on updating zbus again (with more tests). for now, i think the pr should be ready to be merged, so i'll open it since it doesn't seem to introduce any regressions
I think this is not fixed entirely. Icons are updated properly now but I have an icon that doesn't show up at all until after I restart eww. The app is solaar (Logitech mouse manager). If eww is running and I launch solaar, the icon doesn't show up. During login, if solaar is started after eww is started, the icon doesn't show up. If I manually restart solaar, and afterwards restart eww, the icon does show up. Probably some race condition but waybar doesn't have this issue. Let me know if I can do anything to debug this further.