From 36ce75c8c62494a8b639a183b1dacf67d1dc23ac Mon Sep 17 00:00:00 2001 From: kermieisinthehouse Date: Thu, 17 Feb 2022 20:03:41 -0800 Subject: [PATCH] Fix windows systray icon just hanging out (#2330) --- go.mod | 2 +- go.sum | 2 ++ pkg/desktop/systray_nonlinux.go | 1 + .../kermieisinthehouse/systray/systray_windows.go | 12 +++++++++++- vendor/modules.txt | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7d0f109c7..9fcddc5bf 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/go-chi/httplog v0.2.1 github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 github.com/kermieisinthehouse/gosx-notifier v0.1.1 - github.com/kermieisinthehouse/systray v1.2.3 + github.com/kermieisinthehouse/systray v1.2.4 github.com/lucasb-eyer/go-colorful v1.2.0 github.com/vearutop/statigz v1.1.6 github.com/vektah/gqlparser/v2 v2.0.1 diff --git a/go.sum b/go.sum index c799108fc..940295660 100644 --- a/go.sum +++ b/go.sum @@ -498,6 +498,8 @@ github.com/kermieisinthehouse/gosx-notifier v0.1.1 h1:lVXyKsa1c1RUkckp3KayloNLoI github.com/kermieisinthehouse/gosx-notifier v0.1.1/go.mod h1:xyWT07azFtUOcHl96qMVvKhvKzsMcS7rKTHQyv8WTho= github.com/kermieisinthehouse/systray v1.2.3 h1:tawLahcam/Ccs/F2n6EOQo8qJnSTD2hLzOYqTGsUsbA= github.com/kermieisinthehouse/systray v1.2.3/go.mod h1:axh6C/jNuSyC0QGtidZJURc9h+h41HNoMySoLVrhVR4= +github.com/kermieisinthehouse/systray v1.2.4 h1:pdH5vnl+KKjRrVCRU4g/2W1/0HVzuuJ6WXHlPPHYY6s= +github.com/kermieisinthehouse/systray v1.2.4/go.mod h1:axh6C/jNuSyC0QGtidZJURc9h+h41HNoMySoLVrhVR4= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= diff --git a/pkg/desktop/systray_nonlinux.go b/pkg/desktop/systray_nonlinux.go index 34b419aaa..b9f72cbac 100644 --- a/pkg/desktop/systray_nonlinux.go +++ b/pkg/desktop/systray_nonlinux.go @@ -87,6 +87,7 @@ func systrayInitialize(shutdownHandler ShutdownHandler, faviconProvider FaviconP openURLInBrowser("") } case <-quitStashButton.ClickedCh: + systray.Quit() shutdownHandler.Shutdown(0) } } diff --git a/vendor/github.com/kermieisinthehouse/systray/systray_windows.go b/vendor/github.com/kermieisinthehouse/systray/systray_windows.go index 180da3004..55c5b5699 100644 --- a/vendor/github.com/kermieisinthehouse/systray/systray_windows.go +++ b/vendor/github.com/kermieisinthehouse/systray/systray_windows.go @@ -811,7 +811,17 @@ func nativeLoop() { } func quit() { - const WM_CLOSE = 0x0010 + const ( + WM_ENDSESSION = 0x0016 + WM_CLOSE = 0x0010 + ) + + pPostMessage.Call( + uintptr(wt.window), + WM_ENDSESSION, + 0, + 0, + ) pPostMessage.Call( uintptr(wt.window), diff --git a/vendor/modules.txt b/vendor/modules.txt index 6469c1ef4..987bacd0b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -231,7 +231,7 @@ github.com/json-iterator/go # github.com/kermieisinthehouse/gosx-notifier v0.1.1 ## explicit github.com/kermieisinthehouse/gosx-notifier -# github.com/kermieisinthehouse/systray v1.2.3 +# github.com/kermieisinthehouse/systray v1.2.4 ## explicit; go 1.17 github.com/kermieisinthehouse/systray # github.com/lucasb-eyer/go-colorful v1.2.0