getlantern / systray

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

Systray + gotk3 #117

Open Gelembjuk opened 4 years ago

Gelembjuk commented 4 years ago

Hello All, I am building the crossplatform app with windows GUI. I used https://github.com/gotk3/gotk3 and it works fine to make the interface. Also i need systray icon for my app.

I tried this package getlantern/systray and it works fine, on test app. But when i try to build all this together getlantern/systray + gotk3 i do not have success.

When systray runs and i try to start some gtk window , it fails. usually with error (for now i tried only on linux)

Gdk-Message: 12:35:56.171: Linux: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

Sometime there is very long error with stacktrace. This error happens after systray started, if i try to run window before systray started, all works fine

Does anyone know how to solve such problem? Is it possible to make systray working with gotk3 ?

Are there any examples of applications with https://github.com/getlantern/systray/ and some GUI package?

Gelembjuk commented 4 years ago

If you already use gotk3, why not use what it provides? https://github.com/gotk3/gotk3-examples/blob/master/gtk-examples/statusicon/main.go

Thanks for your catch. I really was not able to find it. It would be good to have it everything inside GTK. But it seems this solution doesn't work anymore.

I have just tried . That code can not be compiled

./main.go:73:14: undefined: gtk.StatusIconNewFromIconName
./main.go:79:45: undefined: gtk.StatusIcon
./main.go:80:8: menu.PopupAtStatusIcon undefined (type *gtk.Menu has no field or method PopupAtStatusIcon)

It looks like that functionality was removed from GTK or Golang GTK support.

So, i am still at same point i was before

oxtoacart commented 4 years ago

Is it possible to make systray working with gotk3 ?

It's a bit tricky, because systray actually initializes gtk itself and manages the gtk main loop. I assume that gotk3 wants to do the same thing, so coordinating the two will require some thought and potentially changes to systray.