reddit / emacs
[auto-dark-emacs] now also work with Linux and Windows!!!
LionyxML · 2022-11-21 22:25
LionyxML · 2022-11-21 22:28
Hello there!
Through awesome contribution, \`auto-dark\` now also works with Emacs under Windows and Linux!!!
For now, Linux usage is limited to Gnome DE.
I'd really appreciate anyone who could spend a little bit of time trying it out :)
Project source is available on Github: [https://github.com/LionyxML/auto-dark-emacs](https://github.com/LionyxML/auto-dark-emacs)
And you can also find it on MELPA: [https://melpa.org/#/auto-dark](https://melpa.org/#/auto-dark)
LionyxML · 2022-11-21 22:30
Aaaaand it looks like my typo on the title is gonna live there forever. No more editing allowed :D
CupKax · 2022-11-21 23:26
Will try it out
LukeHoersten · 2022-11-21 23:58
MacOS support by chance?
LionyxML · 2022-11-22 00:03
Sure! It was made for macos originally. This update is to announce compatibility with ALSO Linux and Windows.
[deleted] · 2022-11-22 00:11
[deleted]
LukeHoersten · 2022-11-22 00:11
Great, thanks!!
LionyxML · 2022-11-22 01:07
Great! Thanks!
a-c-d-w · 2022-11-22 03:42
Amazing! You don't happen to have one that goes in reverse do you? I change my emacs theme at sunset automatically
varsderk · 2022-11-22 03:48
Wait, there is a *light mode?!* Who would ever use such a thing?! /s
Snark aside; well done!
covercash2 · 2022-11-22 03:49
Linux has a dark mode?
super-linux-nerd · 2022-11-22 03:58
It's a bit new and not adopted everywhere, but yeah https://flatpak.github.io/xdg-desktop-portal/#gdbus-interface-org-freedesktop-portal-Settings
covercash2 · 2022-11-22 04:01
perfect. thanks for the link!
super-linux-nerd · 2022-11-22 04:06
I made a little video of it on Fedora 37 https://imgur.com/XLj5yWx
dsemy · 2022-11-22 06:04
The Linux support is a bit of a hack (haven't really looked at the Windows and Mac implementation).
I'd guess most people running Linux will also be running a D-Bus session bus, in which case Emacs' built-in support for D-Bus can be utilized for this ([here is my implementation](https://git.sr.ht/~dsemy/emacs-config/tree/master/item/init.d/init-interfaces.el#L44), which should also theoretically support more than just GNOME).
m_sachs · 2022-11-22 07:04
Indeed. Moreover, the new code checks the dark state against Yaru-dark, which is Ubuntu-specific rather than Gnome-specific.
manueldeljesus · 2022-11-22 08:04
I started using circadian just yesterday and was wondering how to make it change theme with the system. My prayers have been listened!!!!
One quick one: is there a way to configure auto-dark without resorting to customize-group so that I can configure it in my config.el?
Thanks in advance.
Aggravating-Step2751 · 2022-11-22 10:23
This seems to work
;;config.el
(use-package auto-dark
:init
(setq auto-dark-dark-theme 'modus-vivendi
auto-dark-light-theme 'modus-operandi)
(auto-dark-mode t))
manueldeljesus · 2022-11-22 10:35
It is not working for me in Doom Emacs. May it be because I use the *Night Theme Switcher* extension to change my Gnome theme and wallpaper?
manueldeljesus · 2022-11-22 10:41
I am using Fedora, and the *Night Theme Switcher* extension and auto-dark is not working for me. Now it makes a little bit more sense.
Aggravating-Step2751 · 2022-11-22 11:17
I haven't tried the switching yet, so can't say!
projectmoon · 2022-11-22 11:36
It's not working due to how it's implemented. It expects you to have the Yaru-dark theme... which not everyone does.
https://github.com/LionyxML/auto-dark-emacs/blob/master/auto-dark.el#L77
Edit: https://github.com/LionyxML/auto-dark-emacs/issues/19
projectmoon · 2022-11-22 11:39
Unless I'm missing something, this only works if you have the `Yaru-dark` theme installed and in use. This isn't a standard GNOME theme (usually it is Adwaita).
It would make more sense to provide configurable variables for the light/dark GTK theme names. Or better yet, make use of the `/org/gnome/desktop/interface/color-scheme` dconf setting. This is the new Gnome standard way of doing dark mode. When it's light, it's `default`, and when it's dark, it's `prefer-dark`. I think it's available from Gnome 42 onwards.
Edit: I created a GitHub issue for this.
projectmoon · 2022-11-22 11:55
And the value from dconf wants to have a `\n` on it, but that is removed by `string-trim`.
projectmoon · 2022-11-22 11:57
This looks better than using a timer. Is there an example of how to actually use the hook in your repo?
aveatquevale · 2022-11-22 12:07
A while ago, I created a patch for emacs 27/28/master to be aware of macOS system appearance changes.
It does not rely on AppleScript to do the job, but rather native KVO; I thought I’d include it here if anyone is interested:
https://gist.github.com/ngquerol/9618d4aba60a6e691c3a4bdbefbdb9e9
It is included in https://github.com/d12frosted/homebrew-emacs-plus, for homebrew users.
dsemy · 2022-11-22 14:33
Each function in the hook is called with ‘dark’ or ‘light’ as the sole argument according to the current color scheme.
Edit: I just realized this is almost word-for-word written in the docstring I wrote for the hook, and the only usage of it in my config is actually in my "personal" file (which isn't tracked by Git).
For the sake of completeness, I use the 'ef-themes' package, and I add it's command 'ef-themes-load-random' to the hook.
This loads either a random dark of light theme, according the argument you pass it ('light' or 'dark').
LionyxML · 2022-12-31 17:03
u/aveatquevale thanks a lot for your effort!
For macOS this is our go-to method (when using emacs-plus) :)
[https://github.com/LionyxML/auto-dark-emacs/blob/master/auto-dark.el#L189](https://github.com/LionyxML/auto-dark-emacs/blob/master/auto-dark.el#L189)
TheGratitudeBot · 2022-12-31 17:10
Thanks for such a wonderful reply! TheGratitudeBot has been reading millions of comments in the past few weeks, and you’ve just made the list of some of the most grateful redditors this week! Thanks for making Reddit a wonderful place to be :)