summaryrefslogtreecommitdiff
path: root/systray.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-07-09 23:34:14 +0200
committerRuben Pollan <meskio@sindominio.net>2018-07-10 13:03:30 +0200
commitfa08af4697c14c5a365ed7ec2b2dce3f67386d49 (patch)
tree2ae1eb50401b3a2b2104444275cabdd31f4d3619 /systray.go
parent2ac0be0c3f431bdefe99b29ab83f3b3c8bd9ea78 (diff)
[feat] autostart the standalone systray if the vpn was on
- Resolves: #8
Diffstat (limited to 'systray.go')
-rw-r--r--systray.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/systray.go b/systray.go
index 28aeb29..1507ff6 100644
--- a/systray.go
+++ b/systray.go
@@ -39,6 +39,7 @@ type bmTray struct {
mDonate *systray.MenuItem
mCancel *systray.MenuItem
activeGateway *gatewayTray
+ autostart autostart
}
type gatewayTray struct {
@@ -46,8 +47,8 @@ type gatewayTray struct {
name string
}
-func run(bm bitmask.Bitmask, conf *systrayConfig, notify *notificator) {
- bt := bmTray{bm: bm, conf: conf, notify: notify}
+func run(bm bitmask.Bitmask, conf *systrayConfig, notify *notificator, as autostart) {
+ bt := bmTray{bm: bm, conf: conf, notify: notify, autostart: as}
systray.Run(bt.onReady, bt.onExit)
}
@@ -131,6 +132,10 @@ func (bt *bmTray) onReady() {
bt.notify.about(versionStr)
case <-mQuit.ClickedCh:
+ err := bt.autostart.Disable()
+ if err != nil {
+ log.Printf("Error disabling autostart: %v", err)
+ }
systray.Quit()
case <-signalCh:
systray.Quit()