From 43b06b2e1a6931113c4b0856a1980da2d2152782 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Fri, 21 Dec 2018 18:23:11 +0100 Subject: [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 --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'main.go') 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) { -- cgit v1.2.3