aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/tray.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-27 17:02:13 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-27 17:49:50 +0200
commitbb953018e976e14ffd80f2f2fc81a22606e0d832 (patch)
tree6efc2186b70bd23b76d2658348b78432353c672b /ui/tray.go
parentui: add icon to about dialog (diff)
downloadwireguard-windows-bb953018e976e14ffd80f2f2fc81a22606e0d832.tar.xz
wireguard-windows-bb953018e976e14ffd80f2f2fc81a22606e0d832.zip
ui: suppress extranous deactivated notification in tray
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--ui/tray.go6
1 files changed, 4 insertions, 2 deletions
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))
}
}