mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3 windows] Support isDarkMode. Add common application event mapping
This commit is contained in:
@@ -178,6 +178,7 @@ func (m *windowsApp) setApplicationMenu(menu *Menu) {
|
||||
}
|
||||
|
||||
func (m *windowsApp) run() error {
|
||||
m.setupCommonEvents()
|
||||
for eventID := range m.parent.applicationEventListeners {
|
||||
m.on(eventID)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//go:build windows
|
||||
|
||||
package application
|
||||
|
||||
import "github.com/wailsapp/wails/v3/pkg/events"
|
||||
|
||||
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
|
||||
events.Windows.SystemThemeChanged: events.Common.ThemeChanged,
|
||||
}
|
||||
|
||||
func (m *windowsApp) setupCommonEvents() {
|
||||
for sourceEvent, targetEvent := range commonApplicationEventMap {
|
||||
m.parent.On(sourceEvent, func(event *Event) {
|
||||
applicationEvents <- uint(targetEvent)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user