skhzhang / time-based-themes

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

change with system theme broken on linux gnome 40, manjaro os #22

Closed ayushhroyy closed 2 years ago

ayushhroyy commented 2 years ago

Setting up to change the theme with system theme simply does not work and stays on light or dark theme only. it also breaks sites like duckduckgo wont go in dark mode with the extension on i think this could be api issue in firefox for linux since i tested dark reader and it also doesnt seem to work in coorporation with system theme. please suggest a solution if this can be fixed throught about:config or custom css. Thank you.

skhzhang commented 2 years ago

Hey @ayushhroyy , the extension uses prefers-color-scheme to detect the system theme.

Unfortunately, Firefox will also set prefers-color-scheme based on whatever theme is currently set (per https://bugzilla.mozilla.org/show_bug.cgi?id=1529323). This causes issues with the extension which I'm still trying to work out.

ayushhroyy commented 2 years ago

Hey @ayushhroyy , the extension uses prefers-color-scheme to detect the system theme.

Unfortunately, Firefox will also set prefers-color-scheme based on whatever theme is currently set (per https://bugzilla.mozilla.org/show_bug.cgi?id=1529323). This causes issues with the extension which I'm still trying to work out.

Hey @skhzhang I have found a solution for this bug by changing layout.css.prefers-color-scheme.content-override to 2 (default value is 3) in about:config. Then the extension successfully works on macOS 11.5 with firefox beta 95.0b8 but i'm yet to test it out on my linux machine. Have a good day, Arigato.

skhzhang commented 2 years ago

@ayushhroyy Thank you! That led me to finding this thread (https://bugzilla.mozilla.org/show_bug.cgi?id=1547818) which led me to finding out there's a WebExtension API which will do exactly the same thing as that about:config preference you found! That API is: browserSettings.overrideContentColorScheme

I'll start working on the change and you should expect this to be implemented in the next release. Again, thank you so much for finding that.

skhzhang commented 2 years ago

This is implemented in 1.4.0 with dd0bf23f7f2bf6f7bf8abc75871138e7db5b4296. Note that Firefox 95 or later is required as that's the version that first supports browserSettings.overrideContentColorScheme.