skhzhang / time-based-themes

Automatically change Firefox's theme based on the time
MIT License
121 stars 13 forks source link

Attempt to fix the “based on the system theme not working” issue #40

Closed easonwong-de closed 1 year ago

easonwong-de commented 1 year ago

More on the variable detect_scheme_change_block:

Its main purpose is to decide whether the change of perfer-color-scheme will trigger checkSysTheme(). In idling state, its value stays as false, which means checkSysTheme() will be triggered by colour scheme change. detect_scheme_change_block will be set as true only in the small time-window between browser.management.setEnabled() // commen.js#354 and browser.theme.update() //common.js#372. That’s because browser.management.setEnabled() applies a theme whose color_scheme property may not be system, which might trigger checkSysTheme() again and potentially cause a theme changing loop.