diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-07-09 23:34:14 +0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2018-07-10 13:03:30 +0200 |
commit | fa08af4697c14c5a365ed7ec2b2dce3f67386d49 (patch) | |
tree | 2ae1eb50401b3a2b2104444275cabdd31f4d3619 /systray.go | |
parent | 2ac0be0c3f431bdefe99b29ab83f3b3c8bd9ea78 (diff) |
[feat] autostart the standalone systray if the vpn was on
- Resolves: #8
Diffstat (limited to 'systray.go')
-rw-r--r-- | systray.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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() |