From fa08af4697c14c5a365ed7ec2b2dce3f67386d49 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Mon, 9 Jul 2018 23:34:14 +0200 Subject: [feat] autostart the standalone systray if the vpn was on - Resolves: #8 --- systray.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'systray.go') 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() -- cgit v1.2.3