From 73668f3fa2d0c3abd08d3479136529792787b633 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 27 Apr 2019 17:02:13 +0200 Subject: ui: suppress extranous deactivated notification in tray --- ui/tray.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/tray.go b/ui/tray.go index 85ba9d54..22c37ab4 100644 --- a/ui/tray.go +++ b/ui/tray.go @@ -246,6 +246,8 @@ func (tray *Tray) SetTunnelState(tunnel *service.Tunnel, state service.TunnelSta actions := tray.ContextMenu().Actions() activeCIDRsAction := actions.At(1) + wasChecked := tunnelAction.Checked() + switch state { case service.TunnelStarted: activeCIDRsAction.SetText("") @@ -263,13 +265,13 @@ func (tray *Tray) SetTunnelState(tunnel *service.Tunnel, state service.TunnelSta } tunnelAction.SetEnabled(true) tunnelAction.SetChecked(true) - if showNotifications { + if !wasChecked && showNotifications { tray.ShowInfo("WireGuard Activated", fmt.Sprintf("The %s tunnel has been activated.", tunnel.Name)) } case service.TunnelStopped: tunnelAction.SetChecked(false) - if showNotifications { + if wasChecked && showNotifications { tray.ShowInfo("WireGuard Deactivated", fmt.Sprintf("The %s tunnel has been deactivated.", tunnel.Name)) } } -- cgit v1.2.3-59-g8ed1b