unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: Lars Ingebrigtsen <larsi@gnus.org>,
	Daphne Preston-Kendal <dpk@nonceword.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Detecting changes between dark and light mode on Mac OS
Date: Tue, 23 Mar 2021 10:49:12 -0700	[thread overview]
Message-ID: <87eeg5hiav.fsf@rfc20.org> (raw)
In-Reply-To: <87h7l5j8hg.fsf@gnus.org>

Lars Ingebrigtsen <larsi@gnus.org> writes:

> 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?

Lars, were you thinking of this thread?

    Stefan Monnier <monnier@iro.umontreal.ca> (November 20)
    Subject: night-mode?
    To: emacs-devel@gnu.org
    Date: Fri, 20 Nov 2020 16:25:35 -0500

    https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00912.html

It looks like Stefan stopped working on it, but it looked promising to
me.  He didn't hook it into the system theme change mechanism I point
out below, but that isn't too much of a leap.

It seems to me that this feature isn't a really about "light vs. dark",
but instead it is more about dynamically responding to changes in the
system theme.  Preferably, any change.

I notice that Emacs does have a Lisp level hook for theme changes today,
currently used by GTK.  See
`dynamic-setting-handle-config-changed-event' in dynamic-setting.el, and
the corresponding call to 'kbd_buffer_store_event' in 'style-changed' in
gtkutil.c.  Today, it seems like GTK responds to the system theme in two
ways:

 - changing the GTK Mono font changes Emacs' default font (not in any
   current frames, but in newly created ones)
 - changing the GTK theme changes the faces used for regions (the
   'region' face, etc., by way of 'gtk_selection_bg_color' and
   'gtk_selection_fg_color' colors).

Daphne, I would suggest hooking into dynamic-setting.el, which implement
the above.  That seems much better than adding something that is similar
but different than what is already in place for GTK.

Today, the dynamic-setting.el stuff invalidates font caches on theme
change but doesn't mess with frames at all.  That is all it needs to do
to support the features I list above.  Responding to theme changes more
dynamically, e.g. by changing the whole Emacs theme, is closer to the
things discussed in Stefan's thread linked above.  It should be about as
easy to design this in a way that works the same across GUI toolkits as
it is to do it for ns only.



  parent reply	other threads:[~2021-03-23 17:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 13:23 Detecting changes between dark and light mode on Mac OS Daphne Preston-Kendal
2021-03-20 16:51 ` Daphne Preston-Kendal
2021-03-20 17:52   ` Alan Third
2021-03-21 11:01     ` Daphne Preston-Kendal
2021-03-21  7:01   ` Lars Ingebrigtsen
2021-03-21 10:22     ` Daphne Preston-Kendal
2021-03-22 20:07       ` Lars Ingebrigtsen
2021-03-23 18:32         ` chad
2021-03-23 17:49     ` Matt Armstrong [this message]
2021-03-24  8:30       ` Lars Ingebrigtsen
2021-03-25 16:33         ` Stefan Monnier
2021-03-28  1:16           ` chad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeg5hiav.fsf@rfc20.org \
    --to=matt@rfc20.org \
    --cc=dpk@nonceword.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).