Subject: bug#64695: 29.0.92; xwidget webkit dark mode support or set all settings from elisp

From: Daniel Nagy <[email-masked]>
Date: Mon, 17 Jul 2023 20:33:22 +0000

Hello,

This is a feature request. Can xwidget webkit support the toggling of
dark mode? This is done by setting the boolean value of the gtk setting
"gtk-application-prefer-dark-theme". Better yet would be to allow to set
all kinds of gtk settings via elisp if this is somehow possible.

A good example of how dark mode can be set, can be seen in the surf
program of the suckless project:

https://git.suckless.org/surf/commit/1f5b8f3bd1f37d4d3dc45d21285f34ef4752dbaa.html

More info on the gtk setting:

https://docs.gtk.org/gtk3/property.Settings.gtk-application-prefer-dark-theme.html

Internally, this enables this css media query, to allow websites to
adapt to this user decision.

https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme

Not all websites make use of this media query, but to test it out you
can check this previous link from MDN. It should turn darker if the gtk
setting is enabled correctly. The file, that would most likely to be
changed is `src/xwidget.c`.

Thank you,

In GNU Emacs 29.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: NixOS 23.11 (Tapir)

Configured using:
 'configure
 --prefix=/nix/store/m4wxxn3yblqsdlswa7k6rxsimyla4gca-emacs-gtk3-29.0.92
 --disable-build-details --with-modules --with-x-toolkit=gtk3 --with-xft
 --with-cairo --with-native-compilation --with-tree-sitter
 --with-xinput2 --with-xwidgets'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS
GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH:
  value of $EMACSNATIVELOADPATH: /nix/store/ax4hv2192br3c62wqilp71w2q0m5psrm-emacs-packages-deps/share/emacs/native-lisp::
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

--
Daniel Nagy