fyne-io / systray

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

Handle systray absence and restarts gracefully #53

Closed bdwalton closed 1 year ago

bdwalton commented 1 year ago

Move registration into a goroutine so that we can handle the case when org.kde.StatusNotifierWatcher is absent at startup or when it is restarted later. (Restarting the systray is common with, eg, i3 or sway config reload.)

In the goroutine, we setup a signal listener for NameOwnerChanged on org.kde.StatusNotifierWatcher so we can handle it coming and going appropriately.

The goroutine will exit when quitChan is closed so it shouldn't leak.