From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.bugs Subject: bug#47291: [PATCH] Auto-detect ns-appearance of frames and call a hook when it changes Date: Tue, 23 Mar 2021 11:05:59 -0700 Message-ID: <87blb9hhiw.fsf@rfc20.org> References: <1B39376A-B108-41FD-87EE-52D68E8F7256@nonceword.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35959"; mail-complaints-to="usenet@ciao.gmane.io" To: Daphne Preston-Kendal , 47291@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 23 19:57:26 2021 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 1lOmDW-0009E4-Me for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 19:57:26 +0100 Original-Received: from localhost ([::1]:55146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOmDV-00059c-Mw for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Mar 2021 14:57:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOlQk-000482-RC for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 14:07:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOlQk-00009X-Jr for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 14:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lOlQk-0005jO-Eo for bug-gnu-emacs@gnu.org; Tue, 23 Mar 2021 14:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Matt Armstrong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Mar 2021 18:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47291-submit@debbugs.gnu.org id=B47291.161652277521967 (code B ref 47291); Tue, 23 Mar 2021 18:07:02 +0000 Original-Received: (at 47291) by debbugs.gnu.org; 23 Mar 2021 18:06:15 +0000 Original-Received: from localhost ([127.0.0.1]:32948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOlPy-0005iE-TP for submit@debbugs.gnu.org; Tue, 23 Mar 2021 14:06:15 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:40811) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lOlPt-0005hr-Ir for 47291@debbugs.gnu.org; Tue, 23 Mar 2021 14:06:13 -0400 X-Originating-IP: 24.113.169.116 Original-Received: from mdeb (24-113-169-116.wavecable.com [24.113.169.116]) (Authenticated sender: matt@rfc20.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 51050C0002; Tue, 23 Mar 2021 18:06:02 +0000 (UTC) Original-Received: from matt by mdeb with local (Exim 4.94) (envelope-from ) id 1lOlPj-000Hi8-Ee; Tue, 23 Mar 2021 11:05:59 -0700 In-Reply-To: <1B39376A-B108-41FD-87EE-52D68E8F7256@nonceword.org> 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" Xref: news.gmane.io gmane.emacs.bugs:202918 Archived-At: Daphne Preston-Kendal writes: > This is a slightly cleaned-up version of the patch I initially posted for > commentary on emacs-devel. > > > The patch makes two closely related changes: when a new frame is > created, the ns-appearance parameter (which was already in Emacs) is > bound to 'light or 'dark depending on the system theme. (Previously, > it could be set explicitly and Emacs would respect that change on a > per-frame basis, but if it wasn't explicitly set it was unbound.) I think GTK already has similar functionality. When I change the GTK theme Emacs' frame decorations change accordingly. So, to me this part of the patch seems fine from the policy perspective that Lars raised on emacs-devel. > Secondly, it registers an event handler for changes to the system-wide > theme, and when the system theme changes, it changes the ns-appearance > parameter of all frames to match the new system theme, and runs a new > hook, ns-dark-mode-changed-hook so that users can e.g. set a new Emacs > theme to match the new system theme or whatever. I suggested an alternative approach on emacs-devel -- use the dynamic-setting.el mechanism which is used for GTK but expressed in a general way. Since Emacs already has that mechanism for GTK, I think this approach would satisfy the policy issue Lars raised as well.