aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/tray.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-29 21:10:38 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-29 21:10:38 +0200
commit59e5a54bc4d5808afc918c7f0de81fe59c6f8da8 (patch)
treee2316076dfb54fd7e610c3b2d1156dd7c1552a92 /ui/tray.go
parentui: rework tunnel adding logic and fix bugs (diff)
downloadwireguard-windows-59e5a54bc4d5808afc918c7f0de81fe59c6f8da8.tar.xz
wireguard-windows-59e5a54bc4d5808afc918c7f0de81fe59c6f8da8.zip
ui: show first active tunnels on window popup
Diffstat (limited to 'ui/tray.go')
-rw-r--r--ui/tray.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui/tray.go b/ui/tray.go
index 2f48d812..8a585f4b 100644
--- a/ui/tray.go
+++ b/ui/tray.go
@@ -52,7 +52,7 @@ func (tray *Tray) setup() error {
tray.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
if button == walk.LeftButton {
- tray.mtw.Show()
+ tray.onManageTunnels()
}
})
@@ -68,7 +68,7 @@ func (tray *Tray) setup() error {
{label: "Networks: None", hidden: true},
{separator: true},
{separator: true},
- {label: "&Manage tunnels...", handler: tray.mtw.Show, enabled: true},
+ {label: "&Manage tunnels...", handler: tray.onManageTunnels, enabled: true},
{label: "&Import tunnel(s) from file...", handler: tray.mtw.tunnelsPage.onImport, enabled: true},
{separator: true},
{label: "&About WireGuard", handler: func() { onAbout(tray.mtw) }, enabled: true},
@@ -297,3 +297,11 @@ func (tray *Tray) UpdateFound() {
tray.ContextMenu().Actions().Insert(tray.ContextMenu().Actions().Len()-2, action)
tray.ShowWarning("WireGuard Update Available", "An update to WireGuard is now available. You are advised to update as soon as possible.")
}
+
+func (tray *Tray) onManageTunnels() {
+ if !tray.mtw.Visible() {
+ tray.mtw.tunnelsPage.tunnelsView.SelectFirstActiveTunnel()
+ tray.mtw.tabs.SetCurrentIndex(0)
+ }
+ tray.mtw.Show()
+}