Skip to content

Commit

Permalink
Use unit64
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed May 5, 2024
1 parent d718580 commit 23c12a3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/app_xdg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ import (
"fyne.io/fyne/v2/theme"
)

var currentVariant atomic.Value
var currentVariant atomic.Uint64

func defaultVariant() fyne.ThemeVariant {
val := currentVariant.Load()
if val == nil {
return theme.VariantDark
}

return val.(fyne.ThemeVariant)
return fyne.ThemeVariant(currentVariant.Load())
}

func (a *fyneApp) OpenURL(url *url.URL) error {
Expand Down Expand Up @@ -128,11 +123,11 @@ func rootConfigDir() string {
func watchTheme() {
go func() {
// with portal this may not be immediate, so we update a cache instead
currentVariant.Store(findFreedesktopColorScheme())
currentVariant.Store(uint64(findFreedesktopColorScheme()))

portalSettings.OnSignalSettingChanged(func(changed portalSettings.Changed) {
if changed.Namespace == "org.freedesktop.appearance" && changed.Key == "color-scheme" {
currentVariant.Store(findFreedesktopColorScheme())
currentVariant.Store(uint64(findFreedesktopColorScheme()))
fyne.CurrentApp().Settings().(*settings).setupTheme()
}
})
Expand Down

0 comments on commit 23c12a3

Please sign in to comment.