emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting changes between dark and light mode on Mac OS


From: Daphne Preston-Kendal
Subject: Re: Detecting changes between dark and light mode on Mac OS
Date: Sun, 21 Mar 2021 11:22:43 +0100

On 21 Mar 2021, at 08:01, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Sorry about the lack of feedback here -- yes, in general, it's better to
> send patches to the issue tracker (i.e., bug-gnu-emacs@gnu.org) than to
> emacs-devel, because patches have a tendency to get lost on emacs-devel.

Okay, thanks — I’ll try there directly.

> In Emacs, we generally don't add features that work on non-free
> operating systems only.  So this should instead be a general
> `dark-mode-changed-hook' feature, with a specific implementation on
> GNU/Linux, Macos, etc.
> 
> And we should definitely have a feature in Emacs to respond to dark-mode
> changes across the board.  I seem to recall there being some discussion
> about this in the past, but I can't find it now.  Does anybody remember
> where that went?

Okay, well, if there are plans to support similar functionality
cross-platform, surely it’s okay to add it just for Mac OS for now?
There’s already quite a few Mac OS specific features in nsterm.m and
nsfns.m. The ns-appearance property on frames, which already provides
a limited form of integration with this Mac OS feature (you can set
the theme to light or dark on a per-frame basis, but it doesn’t tell
you what the system sets it to by default, which my patch fixes) is
one of them!

I don’t know how well standardized the events (and event systems) for
changes in system theme are in other Unix desktop environments, but if
someone does manage to make it work cross-platform, then the
ns-dark-mode-changed-hook from this patch could simply be made an
alias to a new, cross-platform dark-mode-changed-hook. (Though note
that the inspection of which theme was just activated, dark or light,
which typical functions attached to ns-dark-mode-hook would have to
do, also depends on the Mac OS-specific ns-appearance frame property.)

Or is your suggestion that I simply rename this hook to
dark-mode-changed-hook without the ns- prefix, notwithstanding that it
doesn’t currently work on any platform other than Mac OS?

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no

Many thanks,


Daphne Preston-Kendal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]