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.
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.