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

[BUG] Systray doesn't update icons properly #1188

Closed
3 tasks done
krims0n32 opened this issue Sep 2, 2024 · 8 comments · Fixed by #1203
Closed
3 tasks done

[BUG] Systray doesn't update icons properly #1188

krims0n32 opened this issue Sep 2, 2024 · 8 comments · Fixed by #1203
Labels
bug Something isn't working

Comments

@krims0n32
Copy link

krims0n32 commented Sep 2, 2024

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

@krims0n32 krims0n32 added the bug Something isn't working label Sep 2, 2024
@netboy3
Copy link

netboy3 commented Sep 20, 2024

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.

@w-lfchen
Copy link
Contributor

w-lfchen commented Sep 20, 2024

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

@w-lfchen w-lfchen mentioned this issue Sep 20, 2024
1 task
@w-lfchen
Copy link
Contributor

w-lfchen commented Sep 20, 2024

opened #1203, i have yet to find an easy way to reproduce this so please test it throughly

@netboy3
Copy link

netboy3 commented Sep 20, 2024

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.

@netboy3
Copy link

netboy3 commented Sep 20, 2024

@w-lfchen, thank you for the swift response to this issue. I've tested #1203 and verified that it fixes this issue. Systray items are now properly updating again.

@w-lfchen
Copy link
Contributor

w-lfchen commented Sep 20, 2024

i'm glad, can you give me a way to reproduce it

@netboy3
Copy link

netboy3 commented Sep 21, 2024

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.

@w-lfchen
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants