aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/managewindow.go6
-rw-r--r--ui/ui.go11
2 files changed, 15 insertions, 2 deletions
diff --git a/ui/managewindow.go b/ui/managewindow.go
index aa6ec21a..4da7198e 100644
--- a/ui/managewindow.go
+++ b/ui/managewindow.go
@@ -63,7 +63,11 @@ func NewManageTunnelsWindow() (*ManageTunnelsWindow, error) {
mtw.Closing().Attach(func(canceled *bool, reason walk.CloseReason) {
// "Close to tray" instead of exiting application
*canceled = true
- mtw.Hide()
+ if !noTrayAvailable {
+ mtw.Hide()
+ } else {
+ win.ShowWindow(mtw.Handle(), win.SW_MINIMIZE)
+ }
})
mtw.VisibleChanged().Attach(func() {
if mtw.Visible() {
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()