time-based-themes icon indicating copy to clipboard operation
time-based-themes copied to clipboard

macOS requires window focus before theme switches

Open samsalisbury opened this issue 4 years ago • 3 comments

This is more an annoyance than anything, but it would be great if the theme would switch immediately when the system dark mode setting switches. What it does on my machine (Catalina) is waits until I focus one of the Firefox windows before applying the relevant theme. I note that other extensions (e.g. DarkReader) are able to switch modes without focus so I guess there is a way to do this?

Thanks for this extension, it's really useful.

samsalisbury avatar May 12 '20 12:05 samsalisbury

Same problem on Windows, and presumably on linux distros too. This issue wouldn't exist if the system theme listener would work, but it seems the author also mentions it doesn't for some reason.

https://github.com/skhzhang/time-based-themes/blob/373cd42d99b4595514ec6aa2c8d76b6012b516cb/js/common.js#L88-L91

Here's an article on detecting the theme in js: https://medium.com/hypersphere-codes/detecting-system-theme-in-javascript-css-react-f6b961916d48

Perhaps a fallback timer could be used until this is sorted out?

2zqa avatar Sep 10 '20 12:09 2zqa

I'm running the latest version of Windows (Win10 version 20H2) and this is now working for me at time of writing.

If you or anyone else is continuing to have this problem, can you please try the following

  1. Open Firefox to: https://codepen.io/kleinfreund/full/NmpKZM
  2. Change the system dark mode on your OS. Is the "OS exposes prefers-color-scheme as:" value changing from light to dark (or vice versa)?

I took a look at the Dark Reader code and they are doing something similar. If the problem is still happening, I'll have to continue digging into this but I wonder if this was fixed over time in a Firefox update.

Thanks!

skhzhang avatar Dec 29 '20 05:12 skhzhang

Sorry for the late response (happy new year!?). I just did some testing and it still appears to be non-functional. The codepen does work, however. I do have other extensions running, but I am not sure whether that could affect that(?)

I am running Windows 10 20H2 (19042.804).

https://user-images.githubusercontent.com/25235249/108720553-406a2200-7521-11eb-8ce6-2a22aed440dd.mp4

2zqa avatar Feb 22 '21 15:02 2zqa