From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maximiliano Sandoval via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53458: [Request, Linux] Follow system dark mode user preference Date: Sat, 22 Jan 2022 22:14:16 +0000 Message-ID: <3iRhN5EFJnIdFLuFt_CnYryIAZSjHpoq96ZkkxYkI1DJS4cNYRyGd18E92AH1lTjuEY75njusiICZbdF_AD0brAkLZ_9o9Gk435hsZbXiho=@protonmail.com> Reply-To: Maximiliano Sandoval Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7316"; mail-complaints-to="usenet@ciao.gmane.io" To: 53458@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 22 23:15:40 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBOfa-0001je-SJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 23:15:38 +0100 Original-Received: from localhost ([::1]:45378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBOfZ-0006Jg-Aq for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jan 2022 17:15:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBOf0-0006Hv-CA for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 17:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBOf0-0008Hs-1F for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 17:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBOez-00006U-Oi for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 17:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Maximiliano Sandoval Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jan 2022 22:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53458 X-GNU-PR-Package: emacs X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.1642889674337 (code B ref -1); Sat, 22 Jan 2022 22:15:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jan 2022 22:14:34 +0000 Original-Received: from localhost ([127.0.0.1]:38154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBOeX-00005M-Ov for submit@debbugs.gnu.org; Sat, 22 Jan 2022 17:14:34 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:47184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBOeV-00005B-Ms for submit@debbugs.gnu.org; Sat, 22 Jan 2022 17:14:32 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBOeV-00065L-IQ for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 17:14:31 -0500 Original-Received: from mail-0301.mail-europe.com ([188.165.51.139]:50435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBOeT-0008EI-GC for bug-gnu-emacs@gnu.org; Sat, 22 Jan 2022 17:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1642889658; bh=jF3Oz4L47RRGZltdUYrpAZfrJOGO2JbYL77VKXFavu4=; h=Date:To:From:Reply-To:Subject:Message-ID:From:To:Cc; b=Fq1XTon2HOwYnq8YOHNmKLImH9OpQRXSnm4mb6hHnzOuyEpZil3c2SQTrGqXrjSDq 4cAo9MBJ0lVj+GCsIudVpkOflRr8j/mAu/ZugI/3CGiKCh5UdZ1aCg36edMX00FKk9 sPtoDjXEkijSdazqDAZVbE37BmRFrxiSHGziFGPNDE3NBbHIJ/j0Eq2CxCw9Bs23db O6gfH+/94cTvjNN1pYc0Fpt/+SO39LcQmszC3qyZ4X6xsNBjIwd5PaJt0l7LibEpIK MvTtxYINMXs9FohNuxN+jm6ySyLOFjvqwfQt9779sMxBK0KRxEpnbWqkY9Pjq3k2/d SJYlQgk76aPsg== Received-SPF: pass client-ip=188.165.51.139; envelope-from=msandova@protonmail.com; helo=mail-0301.mail-europe.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" X-ACL-Warn: , Maximiliano Sandoval Xref: news.gmane.io gmane.emacs.bugs:224868 Archived-At: Recently a new setting was added to xdg-desktop-portal to declare the user preference for a dark mode. This setting is DE-agnostic=C2=B9 and it is san= dbox 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 tha= t will most likely included its next release. How to implement: Emacs has to read via dbus the value of the setting and l= isten for changes, then (if using a GtkHeaderBar) set the value of GtkSetting:gtk-application-prefer-dark-theme so that the header bar/title b= ar of emacs follows the preference. Ideally there could be `color-scheme` variabl= e 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 hook= s 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/Ini= tiatives/-/wikis/uploads/b590f6ee98c68b652d95708f707ce927/hello.c -- Maximiliano