Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/app_xdg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"fyne.io/fyne/v2/theme"
)

const systemTheme = fyne.ThemeVariant(99)

func (a *fyneApp) OpenURL(url *url.URL) error {
if build.IsFlatpak {
err := openuri.OpenURI("", url.String(), nil)
Expand All @@ -38,7 +40,7 @@ func (a *fyneApp) OpenURL(url *url.URL) error {
func findFreedesktopColorScheme() fyne.ThemeVariant {
colorScheme, err := appearance.GetColorScheme()
if err != nil {
return theme.VariantDark
return systemTheme
}

return colorSchemeToThemeVariant(colorScheme)
Expand Down Expand Up @@ -117,8 +119,10 @@ func watchTheme(s *settings) {
go func() {
// Theme lookup hangs on some desktops. Update theme variant cache from within goroutine.
themeVariant := findFreedesktopColorScheme()
internalapp.CurrentVariant.Store(uint64(themeVariant))
fyne.Do(func() { s.applyVariant(themeVariant) })
if themeVariant != systemTheme {
internalapp.CurrentVariant.Store(uint64(themeVariant))
fyne.Do(func() { s.applyVariant(themeVariant) })
}

portalSettings.OnSignalSettingChanged(func(changed portalSettings.Changed) {
if changed.Namespace == appearance.Namespace && changed.Key == "color-scheme" {
Expand Down
3 changes: 3 additions & 0 deletions app/settings_desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func watchFile(path string, callback func()) *fsnotify.Watcher {
}

func (s *settings) watchSettings() {
if s.themeSpecified {
return // we only watch for theme changes at this time so don't bother
}
s.watcher = watchFile(s.schema.StoragePath(), s.fileChanged)

a := fyne.CurrentApp()
Expand Down
Loading