-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Light/Dark mode detection no longer works on Ubuntu with Fyne 2.5 #5029
Comments
Hmm I had this reported in my app too but I hadn't found the time to look into it. |
It may have been a bug introduced in moving to the https://github.com/fyne-io/fyne/blob/release/v2.4.x/app/app_xdg.go#L37 and https://github.com/fyne-io/fyne/blob/release/v2.5.x/app/app_xdg.go#L39 @Jacalz any ideas? |
The watchTheme code changed between v2.4 and v2.5 too: https://github.com/fyne-io/fyne/blob/release/v2.4.x/app/app_xdg.go#L174 https://github.com/fyne-io/fyne/blob/release/v2.5.x/app/app_xdg.go#L118 @ErikKalkoken if you're able to test that switching back to the v2.4.x implementations restores the correct behavior on startup and detecting the theme switch while the app is running, we could probably get a PR merged to fix this in the meantime while waiting on issues with rymdport/portal to be resolved |
yes, can confirm it works correctly both on startup and while the app is running for 2.4.5 on Ubuntu. The live theme switching is shown in the below video with shows the same simple Fyne app, once compiled with 2.4.5 and once with 2.5: Here is the app: package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Fyne 2.5.0")
w.SetContent(widget.NewLabel("Hello World!"))
w.Resize(fyne.Size{Width: 800, Height: 600})
w.ShowAndRun()
} |
Oh, I was asking if you would be able to test swapping out the implementations of those 2 functions with the 2.4.5 versions in the |
Sorry, but I know too little about that part of the Fyne code to be able fix this myself. |
OK, I can probably get around to it in a day or few next time I am on my Ubuntu machine |
Like mentioned in #5030 (comment), I can not replicate this on Fedora 40. Likely not a bug within the |
Should hopefully fix theme lookup on Ubuntu 22.04 and other Linux distros using too old Gnome versions. Fixes fyne-io#5029 Replaces fyne-io#5030
This comment was marked as outdated.
This comment was marked as outdated.
I have an idea for what could be causing this. I switched from using the old deprecated |
The theme value was looked up before being set for the first time. I also updated to a new version of the portal package that lets us not only use the value when the theme changes (instead of manually loading it again) but also falls back to use the old Read function to look up settings if ReadOne fails. Should hopefully fix fyne-io#5029
I have opened #5061 now. I'm fairly certain that it should fix things once and for all. The main problem that I found on the Fyne side was that changes to how we handle dark/light mode internally had a race condition where the dark theme preference was looked up after the theme was set up. I also made sure to fall back to the |
Fixed ready for v2.5.1 |
The theme value was looked up before being set for the first time. I also updated to a new version of the portal package that lets us not only use the value when the theme changes (instead of manually loading it again) but also falls back to use the old Read function to look up settings if ReadOne fails. Should hopefully fix #5029
Checklist
Describe the bug
Fyne apps normally start in light or dark mode, depending on the current preferences of the OS.
Since Fyne 2.5 this does no longer seam to work on Ubuntu. I tested this with the demo app and it consistently starts in dark mode, even though the OS is set to light mode (see screenshot).
However, if I compile an app with Fyne 2.4.5 it correctly runs in light mode, so this looks to me like a new bug that was introduced with 2.5.
I also tested this on Windows 10, and there the theme detection still works with Fyne 2.5 as expected.
How to reproduce
Screenshots
Example code
N/A
Fyne version
2.5.0
Go compiler version
1.22.4
Operating system and version
Ubuntu 22.04.4 LTS
Additional Information
No response
The text was updated successfully, but these errors were encountered: