pystray icon indicating copy to clipboard operation
pystray copied to clipboard

X11/KDE Plasma: The icon doesn't show up

Open arija-ari opened this issue 1 year ago • 2 comments

I do icon.run_detached(). It works fine on MacOS, but on Linux it would reserve a place in the system tray, but the icon wouldn't load.

My icon is load like this:

def gen_dot_img(size, color):
    # Generate an image and draw a pattern
    image = Image.new('RGBA', (size, size), (255, 0, 0, 0))
    dc = ImageDraw.Draw(image)
    dc.circle((size // 2, size // 2), size // 5, fill=color)
    return image

def main():
    # ...
    dot_img_gray = gen_dot_img(64, 'gray')
    icon = pystray.Icon(name, icon=dot_img_gray, menu=pystray.Menu(
        pystray.MenuItem(text="Start/Stop Capture",
                         action=lambda _: root.event_generate("<<OCRWantToggle>>"), default=True),
        pystray.MenuItem(text="Force Processing Once",
                         action=lambda _: root.event_generate("<<OCRWantForceOnce>>")),
        pystray.MenuItem(
            text="Exit", action=lambda _: root.event_generate("<<WantQuit>>"))
    ))
	icon.run_detached()
    # ...

When I later close my form, I run icon.stop() which will result in "The function passed as setup to the icon did not finish within 5.0 seconds after icon was stopped".

I run my script from a distrobox Linux Mint container on a Debian host to replicate the environment of my friend, who runs Linux Mint natively. The icon loads for him, but not for me. :(

arija-ari avatar Oct 18 '24 13:10 arija-ari

Same problem, worked on pop os 22.04, upgraded to 24.04. It no longer works. Not sure which dependencies are missing

DrissiReda avatar Nov 02 '24 22:11 DrissiReda

I'm having the same issue in an ArcoLinux KDE build. There seems to be an intended spot for the icon to show up, but the icon never actually renders. I tried looking through the xorg code, but unfortunately I'm just not familiar with interacting with xorg so I'm not sure if I'm on the right or wrong track with trying to fix it or figure out what I'm doing wrong.

landlessdrunk avatar Apr 24 '25 01:04 landlessdrunk