diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-13 22:25:20 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-14 09:00:34 +0200 |
commit | 297615a9dc229158132df07c42bac92e42e8ce4a (patch) | |
tree | 09992533f6d96af1944df264f28b1d7556e4e27e /ui/ui.go | |
parent | attacksurface: updates (diff) | |
download | wireguard-windows-297615a9dc229158132df07c42bac92e42e8ce4a.tar.xz wireguard-windows-297615a9dc229158132df07c42bac92e42e8ce4a.zip |
ui: do not use system tray on server core
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | ui/ui.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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() |