summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/systray/run.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/systray/run.go b/pkg/systray/run.go
index d9d39de..ce4a886 100644
--- a/pkg/systray/run.go
+++ b/pkg/systray/run.go
@@ -25,11 +25,14 @@ import (
func Run(conf *Config) {
bt := bmTray{conf: conf, waitCh: make(chan bool)}
- go initialize(conf, &bt)
+ finishedCh := make(chan bool)
+ go initialize(conf, &bt, finishedCh)
bt.start()
+ <-finishedCh
}
-func initialize(conf *Config, bt *bmTray) {
+func initialize(conf *Config, bt *bmTray, finishedCh chan bool) {
+ defer func() { finishedCh <- true }()
if _, err := os.Stat(config.Path); os.IsNotExist(err) {
os.MkdirAll(config.Path, os.ModePerm)
}