summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-12-21 18:23:11 +0100
committerRuben Pollan <meskio@sindominio.net>2018-12-21 19:27:06 +0100
commit43b06b2e1a6931113c4b0856a1980da2d2152782 (patch)
tree4da9ce44b427e6c4ae9ea10f440e905f0ce13ff8 /main.go
parent5600fdb4a685afa9df5ae530b0a29252be033dc8 (diff)
[bug] launch the systray ASAP so notifications work
The linux version of the notifications library we are using doesn't handle the gtk.main loop. It requires the systray to be running to be able to display a notification. Spliting the start of the systray and the loop we can start the systray pretty early and later on launch the main loop once we have bitmask and other stuff ready. - Related: #88
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.go b/main.go
index 6222cde..a9dc9e9 100644
--- a/main.go
+++ b/main.go
@@ -60,11 +60,17 @@ func main() {
os.Exit(0)
}
+ bt := bmTray{conf: conf}
+ go initialize(conf, &bt)
+ bt.start()
+}
+
+func initialize(conf *systrayConfig, bt *bmTray) {
if _, err := os.Stat(bitmask.ConfigPath); os.IsNotExist(err) {
os.MkdirAll(bitmask.ConfigPath, os.ModePerm)
}
- err = acquirePID()
+ err := acquirePID()
if err != nil {
log.Fatal(err)
}
@@ -85,7 +91,7 @@ func main() {
if err != nil {
log.Printf("Error enabling autostart: %v", err)
}
- run(b, conf, notify, as)
+ bt.loop(b, notify, as)
}
func checkAndStartBitmask(b bitmask.Bitmask, notify *notificator, conf *systrayConfig) {