moses-palmer / pystray

GNU General Public License v3.0
482 stars 59 forks source link

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

Open arija-ari opened 1 month ago

arija-ari commented 1 month ago

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. :(

DrissiReda commented 2 weeks ago

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