LionyxML / auto-dark-emacs

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS, Linux or Windows Dark Mode settings
GNU General Public License v2.0
140 stars 34 forks source link

[Feature request] Auto-dark following night light? (GNOME) #26

Closed basille closed 1 year ago

basille commented 1 year ago

Hi! I just discovered this cool Emacs extension which seems great for switching back and forth between light and dark mode with no fuss. I understand that it actually sticks to the whole OS theme, either light or dark. However, there is another option (at least in GNOME) which seems to be called "night light" in English (sorry my OS is in French) that simply dims the screen at night with warmer colors. If left automatic, it does so between sunset and sunrise. My question is thus simple: would it be possible to use this instead to switch between light and dark themes in Emacs? Thanks for considering it! Mathieu.

willmcpherson2 commented 1 year ago

More info on this...

To print the relevant settings:

gsettings list-recursively org.gnome.settings-daemon.plugins.color

(For some reason I couldn't get dconf to print anything useful)

On my system, these are the sunrise and sunset times:

org.gnome.settings-daemon.plugins.color night-light-schedule-to 6.0
org.gnome.settings-daemon.plugins.color night-light-schedule-from 20.0

However, I just use the Night Theme Switcher extension, which I highly recommend.

basille commented 1 year ago

Nice, thanks @willmcpherson2 for the gsettings!

I know I could use a dark and light theme for the entire desktop, and I'm currently playing with it, but I still prefer night light instead of a full dark theme at the OS scale. Hence my question and feature request to know if auto-dark-emacs could honour this setting instead of the OS theme switch. On top of that, I understand that the automatic timing of the Night Theme Switcher extension is actually controlled by night light?

Would be much appreciated!

LionyxML commented 1 year ago

Hello there! Thanks for bringing this to light @basille!

@J3RN . Would you like to contribute to the discussion?

real-or-random commented 1 year ago

I know I could use a dark and light theme for the entire desktop, and I'm currently playing with it, but I still prefer night light instead of a full dark theme at the OS scale.

It's up to @LionyxML of course, but I feel that's not really in the scope of the package, which is about respecting the OS dark mode setting.

If you need to change themes based on schedule or even sunset/sunrise, there are other packages already available:


Besides that, I think it's more complicated than simply reading times from gsettings, because Night Light also supports the setting "Sunset to Sunrise.


On top of that, I understand that the automatic timing of the Night Theme Switcher extension is actually controlled by night light?

No directly. It has its own settings but you can set them to the same values as in night light.

real-or-random commented 1 year ago

If you need to change themes based on schedule or even sunset/sunrise, there are other packages already available:

* [hmatheisen/theme-switcher](https://github.com/hmatheisen/theme-switcher)

* [hadronzoo/theme-changer](https://github.com/hadronzoo/theme-changer)

Also just found this: https://gitlab.com/WhyNotHugo/darkman

basille commented 1 year ago

Thanks @real-or-random for the feedback! To be fair, I have been using circadian for Emacs for switching themes at sunset/sunrise (which it does very well). The trick here is that all Emacs packages I have seen for theme switching at sunset/sunrise rely on geographic coordinates (lat/lon), which you need to manually change whenever you move.

Since Auto-dark for Emacs relies on system settings (GNOME in this case) to switch between light/dark mode, that made me think that it could be relatively inexpensive to follow system-wide night light alternatively. (I'm OK with GNOME using my coordinates for this matter)

LionyxML commented 1 year ago

That said. I agree to keep auto-dark as it is for now.

Thanks for the discussion!