fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
23.94k stars 1.34k forks source link

Tray: Child menu items of a parent won't display if there is more than one parent item on Linux Mint #4843

Open joshuar opened 1 month ago

joshuar commented 1 month ago

Checklist

Describe the bug

I am constructing a tray menu with the following structure:

Two parent items, one which has two child items.

On some Linux distributions, such as Linux Mint, the child menu items do not display. They do display on other distributions like Fedora. I am unsure why the different distribution would change the behaviour of the same code?

How to reproduce

Run the example code:

Screenshots

On Fedora:

image

On Mint:

Screenshot from 2024-05-16 12-58-10

Example code

The code:

package main

import (
    "fyne.io/fyne/v2"
    "fyne.io/fyne/v2/app"
    "fyne.io/fyne/v2/cmd/fyne_demo/data"
    "fyne.io/fyne/v2/driver/desktop"
    "fyne.io/fyne/v2/widget"
)

func main() {
    a := app.NewWithID("fyne-test")
    a.SetIcon(data.FyneLogo)

    w := a.NewWindow("SysTray")

    aMenu := fyne.NewMenuItem("Menu 1", nil)
    aMenuWithChild := fyne.NewMenuItem("Menu 2", nil)
    aMenuWithChild.ChildMenu = fyne.NewMenu("",
        fyne.NewMenuItem("Childmenu 1", nil),
        fyne.NewMenuItem("Childmenu 2", nil))
    if desk, ok := a.(desktop.App); ok {
        m := fyne.NewMenu("MyApp",
            aMenu,
            aMenuWithChild,
        )
        desk.SetSystemTrayMenu(m)
    }

    w.SetContent(widget.NewLabel("Fyne System Tray"))
    w.SetCloseIntercept(func() {
        w.Hide()
    })
    a.Run()
}

Fyne version

2.4.5

Go compiler version

go version go1.22.2 linux/amd64

Operating system and version

Fedora 40 and Linux Mint

Additional Information

No response

andydotxyz commented 2 weeks ago

This will relate to the desktop environment not the distribution (they have different defaults). Can you please confirm which desktop (and version) is in use for both of your setups?

joshuar commented 1 week ago

The problem occurs with:

The problem does not occur with:

Let me know if you need any more information!