skhzhang / time-based-themes

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

The theme is not changed without user interaction #53

Open and7ey opened 3 months ago

and7ey commented 3 months ago

Description I wanted to use Firefox + automaticDark to change theme of Home Assistant installed on my wall-mounted iPad. I.e. the theme should be changed automatically, without use interaction. But it doesn't work, the theme is not changed.

I tried to test it on another machine, but it doesn't work here also -

System Information

Steps To Reproduce

  1. Go to 'addon settings'
  2. Change mode to Manually set sunrise/sunset times
  3. Choose closest sunset time (i.e. current time + 2 minutes)
  4. Wait for 2 minutes to pass (Firefox is still focused, but not touched)
  5. Firefox theme should be changed to Nighttime theme
  6. Nothing happens until I start to interact (not sure what exactly helps - change tab, update the page or something else).

Expected behaviour The theme is changed exactly at chosen sunset time without user interaction.

Additional context Here is the log to change sunset time to 16:09:

16:08:33.455 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:33.456 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:33.456 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:08:33.456 automaticDark DEBUG: Changing logo to: day-mode [options.js:139:25]
16:08:33.457 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:33.457 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:33.457 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:08:33.457 automaticDark DEBUG: Changing logo to: day-mode [options.js:139:25]
16:08:34.321 automaticDark DEBUG: Start checkTime [common.js:287:17]
16:08:34.322 automaticDark DEBUG: It is currently: 16:8. Conducting time check now... [common.js:288:17]
16:08:34.322 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:34.323 automaticDark DEBUG: Start createAlarm [common.js:193:17]
16:08:34.323 automaticDark DEBUG: Start timeInBetween [utils.js:10:17](moz-extension://92f154b0-93ca-4092-ace8-3340d1f64314/js/utils.js)
16:08:34.323 automaticDark DEBUG: It is currently daytime [utils.js:31:25](moz-extension://92f154b0-93ca-4092-ace8-3340d1f64314/js/utils.js)
16:08:34.324 automaticDark DEBUG: Start enableTheme [common.js:351:17]
16:08:34.325 automaticDark DEBUG: 100 enableTheme - firefox-compact-light@mozilla.org is already enabled. [common.js:364:29]
16:08:34.326 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:34.327 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:34.327 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:34.327 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:08:34.328 automaticDark DEBUG: Changing logo to: day-mode 2 [options.js:139:25]
16:08:34.932 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:34.933 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:34.933 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:08:34.933 automaticDark DEBUG: Changing logo to: day-mode [options.js:139:25]
16:08:34.934 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:08:34.934 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:08:34.934 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:08:34.935 automaticDark DEBUG: Changing logo to: day-mode [options.js:139:25]

here are some errors at 16:09:

16:09:00.005 ReferenceError: AUTOMATIC_SUNTIMES_KEY is not defined [common.js:249:43]
16:09:00.005
AUTOMATIC_SUNTIMES_KEY is not defined [common.js:249:43]

and when I touch the browser:

16:10:22.014 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:22.014 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:22.015 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:22.016 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:22.016 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:22.017 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:22.018 automaticDark DEBUG: Changing logo to: night-mode 2 [options.js:139:25]
16:10:23.216 GET https://github.githubassets.com/favicons/favicon-dark.svg [HTTP/2 200  0ms]
16:10:24.378 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:24.379 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:24.379 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:24.384 automaticDark DEBUG: Changing logo to: night-mode [options.js:139:25]
16:10:24.386 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:24.386 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:24.387 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:24.391 automaticDark DEBUG: Changing logo to: night-mode [options.js:139:25]
16:10:24.846 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:24.846 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:24.846 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:24.847 automaticDark DEBUG: Changing logo to: night-mode [options.js:139:25]
16:10:24.847 automaticDark DEBUG: Browser storage changed. Change logo on Options page. [options.js:47:17]
16:10:24.847 automaticDark DEBUG: Start changeLogo [options.js:132:17]
16:10:24.847 automaticDark DEBUG: Start changeOptionsPageTheme [options.js:160:17]
16:10:24.848 automaticDark DEBUG: Changing logo to: night-mode [options.js:139:25]
oxysoft commented 3 months ago

I have the same problem but with "Change theme based on the system theme".

alexsalex commented 2 months ago

Same with me, only when I change the theme, it's changed.

Change mode: Change themes based on the system theme

elhennig commented 1 month ago

Same here running FF 127.0.2 on Linux: The theme is not changed for location based setup anymore, it only works for the specified time. Not with location nor with following the system theme in KDE

04bondgoods commented 3 weeks ago

same here, seems that the extension doesn't actively monitor the system theme change if firefox's not interacted

KSekator commented 3 days ago

FF 129.0.1 Win 11. The extension does not work in any mode. When system theme switches, the extension only changes the background colour, however the colouring of the tab bar remains the same and could only be changed manually. Can't really find any solution for Firefox to automatically switch light/dark theme based on system setting :(