From 1580bb0a4c4a3f9b35e27980f26f1933d213c84d Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sun, 26 Nov 2023 21:44:58 +0000 Subject: [PATCH] Fix to remove systray id from Windows and macOS --- internal/driver/glfw/driver_desktop.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/driver/glfw/driver_desktop.go b/internal/driver/glfw/driver_desktop.go index 5660d745ed..b317bc35c0 100644 --- a/internal/driver/glfw/driver_desktop.go +++ b/internal/driver/glfw/driver_desktop.go @@ -46,12 +46,16 @@ func (d *gLDriver) SetSystemTrayMenu(m *fyne.Menu) { d.SetSystemTrayIcon(theme.BrokenImageIcon()) } - app := fyne.CurrentApp() - title := app.Metadata().Name - if title == "" { - title = app.UniqueID() + // Some XDG systray crash without a title (See #3678) + if runtime.GOOS == "linux" || runtime.GOOS == "openbsd" || runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" { + app := fyne.CurrentApp() + title := app.Metadata().Name + if title == "" { + title = app.UniqueID() + } + + systray.SetTitle(title) } - systray.SetTitle(title) // it must be refreshed after init, so an earlier call would have been ineffective d.refreshSystray(m)