[V3/macos] Fix systray click handling when no attached window (#3207)

* Fix systray click handling

* Open Menu if no window is attached in defaultClickHandler()

* Remove systemTraySetMenu function

* Fix a crash in hide-window example

* Update changelog
This commit is contained in:
Thomas Sénéchal
2024-01-17 22:36:22 +11:00
committed by GitHub
parent dff47263d5
commit 44bbce125b
6 changed files with 4 additions and 21 deletions
+2 -3
View File
@@ -6,8 +6,8 @@ import (
"runtime"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/icons"
"github.com/wailsapp/wails/v3/pkg/events"
"github.com/wailsapp/wails/v3/pkg/icons"
)
func main() {
@@ -44,7 +44,6 @@ func main() {
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
}
// Click Dock icon tigger application show
app.On(events.Mac.ApplicationShouldHandleReopen, func(event *application.Event) {
println("reopen")
@@ -62,7 +61,7 @@ func main() {
systemTray.SetMenu(myMenu)
systemTray.OnClick(func() {
app.CurrentWindow().Show()
window.Show()
})
err := app.Run()