aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/ui.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-13 22:25:20 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 09:00:34 +0200
commit3dc25740607183f187973129e92aa6d19c271ae6 (patch)
tree09992533f6d96af1944df264f28b1d7556e4e27e /ui/ui.go
parentattacksurface: updates (diff)
downloadwireguard-windows-3dc25740607183f187973129e92aa6d19c271ae6.tar.xz
wireguard-windows-3dc25740607183f187973129e92aa6d19c271ae6.zip
ui: do not use system tray on server core
Diffstat (limited to 'ui/ui.go')
-rw-r--r--ui/ui.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 4ee684bc..972a7087 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -8,12 +8,15 @@ package ui
import (
"fmt"
"github.com/lxn/walk"
+ "github.com/lxn/win"
"golang.zx2c4.com/wireguard/windows/service"
+ "golang.zx2c4.com/wireguard/windows/version"
"runtime"
"runtime/debug"
"time"
)
+var noTrayAvailable = false
var shouldQuitManagerWhenExiting = false
var startTime = time.Now()
@@ -33,6 +36,8 @@ func RunUI() {
tray *Tray
)
+ noTrayAvailable = version.OsIsCore()
+
for mtw == nil {
mtw, err = NewManageTunnelsWindow()
if err != nil {
@@ -40,7 +45,7 @@ func RunUI() {
}
}
- for tray == nil {
+ for tray == nil && !noTrayAvailable {
tray, err = NewTray(mtw)
if err != nil {
time.Sleep(time.Millisecond * 400)
@@ -75,6 +80,10 @@ func RunUI() {
}
}()
+ if noTrayAvailable {
+ win.ShowWindow(mtw.Handle(), win.SW_MINIMIZE)
+ }
+
mtw.Run()
tray.Dispose()
mtw.Dispose()