Closed sampaioletti closed 5 years ago
Systray icons are probably better to be in their own repo. Windows notifications currently use good library that can be used for that github.com/tadvi/systray.
For Linux, I don't think it is possible without CGO, usually, GTK+ or Qt is used there. I know there is pure/native lib for X11 https://github.com/BurntSushi/xgb, but not sure if that alone is enough to implement that, probably is, but for older standard.
And again, for macOS probably not possible without CGO.
Here is a solution in C https://stackoverflow.com/a/45406723 which could be translated to xgb with Xembed(?) without the need for cgo.
Specs: https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-0.3.html (old) https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/ (new) - this probably only needs dbus
Xembed is here https://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html, but not sure how is used in relation to systemtray-spec-0.3. It looks like that can work, in theory at least, together with StatusNotifier support and dbus.
Usually, you want to add some menu to tray icon, and then you will need some toolkit, or at least to draw controls with plain X, something like that. But just handling mouse events can also be useful I think.
Ok sounds good, I was going to research it to see how possible it was, but this makes sense.
Thanks for the great repo!
Just started using the library and I like how it has been written using pure go and syscalls. While there are cgo packages that handle system tray icons i haven't found one that uses syscalls and was thinking of trying it. Would it be within the scope of this project to add that in? If so I will start looking into it.