@@ -36,7 +36,9 @@ func settingsWindow(s *FyneScreen) fyne.CanvasObject {
3636 themeName := lang .L (fyne .CurrentApp ().Preferences ().StringWithFallback ("Theme" , "System Default" ))
3737 dropdownTheme .PlaceHolder = themeName
3838 parseTheme (themeName )
39- go detectSystemThemeChange ()
39+
40+ s .systemTheme = fyne .CurrentApp ().Settings ().ThemeVariant ()
41+ go detectSystemThemeChange (s )
4042
4143 ffmpegText := widget .NewLabel ("ffmpeg " + lang .L ("Path" ))
4244 ffmpegTextEntry := widget .NewEntry ()
@@ -177,13 +179,9 @@ func parseTheme(t string) {
177179 fyne .CurrentApp ().Settings ().SetTheme (go2tvTheme {"Dark" })
178180 fyne .CurrentApp ().Preferences ().SetString ("Theme" , "Dark" )
179181 default :
180- fyne .CurrentApp ().Settings ().SetTheme (go2tvTheme {"System Default" })
181182 fyne .CurrentApp ().Preferences ().SetString ("Theme" , "System Default" )
182183
183- // Wait for the SystemVariant variable to change
184- <- signalSystemVariantChange
185-
186- switch systemVariant {
184+ switch fyne .CurrentApp ().Settings ().ThemeVariant () {
187185 case theme .VariantDark :
188186 fyne .CurrentApp ().Settings ().SetTheme (go2tvTheme {"Dark" })
189187 case theme .VariantLight :
@@ -212,16 +210,17 @@ func parseLanguage(s *FyneScreen) func(string) {
212210 }
213211}
214212
215- func detectSystemThemeChange () {
213+ func detectSystemThemeChange (s * FyneScreen ) {
216214 tik := time .NewTicker (time .Second )
215+
217216 for range tik .C {
217+ currentSystemTheme := fyne .CurrentApp ().Settings ().ThemeVariant ()
218218 themeName := fyne .CurrentApp ().Preferences ().StringWithFallback ("Theme" , "System Default" )
219- if themeName == "System Default" {
220- fyne .CurrentApp ().Settings ().SetTheme (go2tvTheme {"System Default" })
221- // Wait for the SystemVariant variable to change
222- <- signalSystemVariantChange
223219
224- switch systemVariant {
220+ if s .systemTheme != currentSystemTheme && themeName == "System Default" {
221+ s .systemTheme = currentSystemTheme
222+
223+ switch s .systemTheme {
225224 case theme .VariantDark :
226225 fyne .CurrentApp ().Settings ().SetTheme (go2tvTheme {"Dark" })
227226 case theme .VariantLight :
0 commit comments