unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53458: [Request, Linux] Follow system dark mode user preference
@ 2022-01-22 22:14 Maximiliano Sandoval via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-23  2:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Maximiliano Sandoval via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-22 22:14 UTC (permalink / raw)
  To: 53458

Recently a new setting was added to xdg-desktop-portal to declare the user
preference for a dark mode. This setting is DE-agnostic¹ and it is sandbox
friendly. The dark mode setting will be officially supported in GNOME 42,
elementary OS already supports it, and there is a merge request for KDE that
will most likely included its next release.

How to implement: Emacs has to read via dbus the value of the setting and listen
for changes, then (if using a GtkHeaderBar) set the value of
GtkSetting:gtk-application-prefer-dark-theme so that the header bar/title bar of
emacs follows the preference. Ideally there could be `color-scheme` variable for
which the user can set values

 * prefer-light
 * prefer-dark
 * follow-system

and a `is-dark-mode` variable so that users can read its value and add hooks to
it.

Note that desktops environments might add dark/light mode schedulers based on
the time of the day, so it is important to be able to set hooks and listen to
the dbus for changes of the setting.

Relevant devel discussions:

- https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg01737.html
- https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00482.html

Relevant material:

- Freedesktop spec: https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.Settings
- GNOME Dark mode initiative: https://gitlab.gnome.org/GNOME/Initiatives/-/issues/32
- C example (taken from the initiative): https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/uploads/b590f6ee98c68b652d95708f707ce927/hello.c

--
Maximiliano





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-23 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 22:14 bug#53458: [Request, Linux] Follow system dark mode user preference Maximiliano Sandoval via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-23  2:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-23 11:02   ` Rudolf Schlatte
2022-01-23 13:14     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).