Subject: bug#68766: 29.2; Windows dark/light mode changes does not reflect on Emacs Title bar/Scrollbar

From: Rudolf Schlatte <[email-masked]>
Date: Tue, 30 Jan 2024 12:57:45 +0100

Stefan Kangas <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> It's "by design", in the sense that this is how the Dark theme support
>> is implemented in Emacs.  If someone submits changes to react to theme
>> change immediately for all the frames, we can consider that for
>> inclusion.
>
> I think that would be a useful feature, indeed.
>
> AFAIU, the point of light/dark mode for many users is that they want to
> use different settings depending on the time of day.  This needs the
> Emacs frame to react to it when the time switches (as most programs in
> desktop environments like Gnome, or even macOS, do).

This is what I have in my init file, conditionalized on (eq
window-system 'mac).  It's not the nicest API, but maybe serves as an
inspiration for a better-designed, more general hook.

(add-hook 'mac-effective-appearance-change-hook
             #'(lambda () (pcase (plist-get (mac-application-state) :appearance)
                            ("NSAppearanceNameDarkAqua" (load-theme 'ef-night t))
                            ("NSAppearanceNameAqua" (load-theme 'ef-frost t)))))