fyne-io / systray

a cross platfrom Go library to place an icon and menu in the notification area
Apache License 2.0
227 stars 42 forks source link

`SetTitle` is not working #26

Open upendra-web opened 1 year ago

upendra-web commented 1 year ago

Hi, thanks for creating a fork of lantern's systray.

I tried the below code with systray library

package main

import (
    "fyne.io/systray"
    "fyne.io/systray/example/icon"
)

func main() {
    systray.Run(onReady, onExit)
}

func onReady() {
    systray.SetIcon(icon.Data)
    systray.SetTitle("Awesome App")
    systray.SetTooltip("Pretty awesome超级棒")
    mQuit := systray.AddMenuItem("Quit", "Quit the whole app")

    // Sets the icon of a menu item. Only available on Mac and Windows.
    mQuit.SetIcon(icon.Data)
}

func onExit() {
    // clean up here
}

But I couldn't see the title in system tray systray_issue

So was this intentional? Or this is an issue? Thanks in advance!

System and package details

OS: Ubuntu 21.10 Desktop environment: Gnome 40.4.0 Package version: fyne.io/systray v1.10.0 Go version: 1.18

andydotxyz commented 1 year ago

Can you confirm where the title was expected to appear? My understanding is that it appears on tooltip, but it was not clear from the screenshot that this was not the case?

upendra-web commented 1 year ago

I tried the below code with latern's systray module

package main

import (
    "github.com/getlantern/systray"
    "github.com/getlantern/systray/example/icon"
)

func main() {
    systray.Run(onReady, onExit)
}

func onReady() {
    systray.SetIcon(icon.Data)
    systray.SetTitle("Awesome App")
    systray.SetTooltip("Pretty awesome超级棒")
    mQuit := systray.AddMenuItem("Quit", "Quit the whole app")

    // Sets the icon of a menu item. Only available on Mac and Windows.
    mQuit.SetIcon(icon.Data)
}

func onExit() {
    // clean up here
}

It rendered the title beside the icon as below systray_latern

So with fyne.io's systray module I thought the result might be the same.

upendra-web commented 1 year ago

And just FYI, the Quit you see in the screenshot is a menu option, not a tooltip.

upendra-web commented 1 year ago

Hi @andydotxyz, any updates on the above, is it an issue or design choice?

andydotxyz commented 1 year ago

I have checked out the protocol and the code, it should work. Do you see any error on the command line when running the app?

andydotxyz commented 1 year ago

It could be a difference in how your window manager handles legacy system tray and the new "AppIndicator" tray items, i'm not entirely sure, as Gnome does not work on this computer. We are passing the title to the DE correctly as far as I can see, but it is up to the panel whether or not it is displayed. However in the old model the app controls what is drawn, so the getlantern code may have been forcing it before?

upendra-web commented 1 year ago

Yeah, that might be the problem of the DE, I will also try to check the getlatern's code. Thanks @andydotxyz for the clarification.

Can you clarify a doubt, is it ok to encode a SVG(which has some text) to byte array and pass that to SetIcon?

andydotxyz commented 1 year ago

Can you clarify a doubt, is it ok to encode a SVG(which has some text) to byte array and pass that to SetIcon?

I'm pretty sure that the image data must be bitmap (.png even). In the Fyne library we can rasterise SVG, but the OS systray cannot and this library does not have that feature either.

henri9813 commented 3 months ago

Hello,

Any update on this subject? why it works on get lantern initial project and not this one ?

On MacOS, I don't have the issue but I got it on windows.

andydotxyz commented 3 months ago

Windows does not support having text next to the system tray icon, so it will show as a tooltip (if none other is set) instead.

For the title issue of this ticket we were waiting for more information from the OP.

henri9813 commented 3 months ago

Thanks for your feedback.

Maybe could we add this to documentation ?

andydotxyz commented 3 months ago

If it is confirmed that is the answer we could close it with a doc update.

Though I am curious about your comment, how does it look on Windows with the original project?

Any update on this subject? why it works on get lantern initial project and not this one ?

ar065 commented 1 month ago

Having the same issue here on KDE, although getlantern/systray has the same issue for me.

andydotxyz commented 1 month ago

I don't think KDE supports inserting text to the system tray. Can you show any app which does that?