From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Elijah G." Newsgroups: gmane.emacs.devel Subject: Re: Add Tango and Adwaita icons for the toolbar Date: Fri, 10 May 2024 09:43:26 -0600 Message-ID: <86zfsxy8o1.fsf@gmail.com> References: <15F31342-2F2E-4F1E-9FE2-D8F1A62BCC5A@gmail.com> <2F9EE9AF-EEE6-4296-9FDA-B9F8C1B1EE6A@gmail.com> <16A36319-611E-4D49-B374-BE2AE1928D5D@gmail.com> <865xvm1kz0.fsf@gmail.com> <861q6a5eof.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18869"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: casouri@gmail.com, emacs-devel@gnu.org, luangruo@yahoo.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 10 17:44:29 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s5SQ9-0004hl-LW for ged-emacs-devel@m.gmane-mx.org; Fri, 10 May 2024 17:44:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5SPN-0007Lv-De; Fri, 10 May 2024 11:43:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5SPL-0007Ln-QH for emacs-devel@gnu.org; Fri, 10 May 2024 11:43:39 -0400 Original-Received: from mail-oo1-xc42.google.com ([2607:f8b0:4864:20::c42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5SPJ-00056n-7d; Fri, 10 May 2024 11:43:38 -0400 Original-Received: by mail-oo1-xc42.google.com with SMTP id 006d021491bc7-5b2735f217aso1007862eaf.2; Fri, 10 May 2024 08:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715355812; x=1715960612; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=wrEl0Z9e965xAe5sBf5sK+N1oO3cKUt83gMWbaTUcpo=; b=Cl0omK6SsOiN99WLCDpEdAyjA1otOWrqbQXhv8Jis7khOrFOJcTDvf1RtGVrvX9Mwp entHieSelUYg0vmhoeYOVIBkwyJqmXTxCyF/AiHDtXG//J2sjLGWuWoZ+DyzZi/T2Bsu LveltYsN6z52WXIlsExeOa0E6LZG9/GKCtUQBPRpEVaQNJed1tnZkODCAHUu9md/BlO6 Ef/ax00QPvpa6BxPITKZ8dUgL/R96kRz6BrlvvW2NUr0y/+Mqy8kKfS0O5eOsq0ONvjd kb/2BQJpNSfv5u5f5tt7dGRf6dwseMRH6MprJlrDJ4tj153+KsxxwMjJ/cvQZWeFeKDy Va1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715355812; x=1715960612; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wrEl0Z9e965xAe5sBf5sK+N1oO3cKUt83gMWbaTUcpo=; b=g8rNeFy6xjaobrcWJwxKNrVrhgcjEnqEtDvZJdk+aBrIhrY/daGgCHTZeezlHs2614 EMRhtXs9a6D2kl3kqxMhiXOnQOCNp/hbncUDTxMvaABeV+a79Jrnk6/D88uIUKDT4TxR D/PTC6V2L9QHE+sfNZlCzwgJ7o4++2CgONMLFAS2SxUkMba5QyebcXa1dv8ZTVYILk7a GGS+fFv+zRp2qd4v6LGvNSFJzngPKx276DW9UGEpCP1y9Cnb/TGHJ4zOAwmN/j/hacs/ whAjcB9ax/oqdYFciY7ejffCjyH40w3CVTS5WwQyZ6920NCoLlnirAmCMS1Wi6fOqbcq nwpg== X-Forwarded-Encrypted: i=1; AJvYcCWzMFPofgjHeZhpXlDi45F1pR88UKalr7fq5jA7CpaQb9Jfi48HJug+ePgUZSUmnn/IWHtP5y/zaMDs9MPM1C1mRKx/ X-Gm-Message-State: AOJu0Yzm4LflOfj6ah8UnCj/hOzfKuiHFIcmbjWaUWBJn/Ubt3mlPZTl AeOeco3EaBqqaPtyTgRfQTski7Euu3aIRACEIurGTq5BYwqB4fpX X-Google-Smtp-Source: AGHT+IFE+OeS2nF6bg+ygHVoBSBkmbTZC6q3KAxKNIpk8omZaShVs9+Z6kNNh0pzWBAs9lHN/RrSQQ== X-Received: by 2002:a4a:5487:0:b0:5aa:596c:52d0 with SMTP id 006d021491bc7-5b2819a49dbmr3307757eaf.6.1715355812003; Fri, 10 May 2024 08:43:32 -0700 (PDT) Original-Received: from LIBERO ([187.184.27.251]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5b295f5a519sm5902eaf.15.2024.05.10.08.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 08:43:31 -0700 (PDT) In-Reply-To: <861q6a5eof.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 May 2024 10:06:24 +0300") Received-SPF: pass client-ip=2607:f8b0:4864:20::c42; envelope-from=eg642616@gmail.com; helo=mail-oo1-xc42.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319146 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: "Elijah G." >> Cc: , Po Lu >> Date: Thu, 09 May 2024 20:04:03 -0600 >>=20 >> > We also need some way to opt-out of the new icons. I=E2=80=99ll try to= figure >> > it out. >>=20 >> I've made a litle patch that can help in that (note: I've not tested it >> yet and i don't think i can test it :( ). >> The new icons are enabled by default but it can be switched to the >> current ones (also i think that defcustom should specify that it must >> be set in early-init.el because AFAIK tool-bar can not refresh the icons= ). > > Is "tool-bar theme" really a good idea for this? AFAIK, we didn't > decide to introduce "tool-bar themes", and so doing this as part of > adding new icons is not TRT, it should be a separate and > well-documented decision, since the results are visible to users. I didn't mean a tool-bar theme, i didn't know how to name to that defcustom so i thought in name it `tool-bar-icon-theme', i was thinking in something like tool-bar-icon-style or similar since that patch is only a draft. >> + (xpm-spec (list :type 'xpm :file >> + (concat icon >> + (if (eq tool-bar-icon-theme 'tango) "t= ango/") >> + ".xpm"))) > > Shouldn't you _prepend_ "tango/" to the icon's file name? Sorry i thought it was prepended it. > In any case, I find this way of implementing a tool-bar theme > inelegant: we'd need a test for each supported theme, which doesn't > scale. > > This issue needs more thought and discussions. Let's not mix the new > icons with this "theme" issue. Sorry, wasn't my intention making another issue, it was just an idea based in the other messages of this thread about making the new icons as an optional feature and allow change them to the original (current) ones, this patch was intended to be used as base for this. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-SVG-and-tango-icon-theme-support.patch Content-Description: FIXED PATCH >From 49019a3938269ae2ecf7e55df943e6808fb86eb6 Mon Sep 17 00:00:00 2001 From: "Elias G. Perez" Date: Thu, 9 May 2024 19:18:43 -0600 Subject: [PATCH] SVG and tango icon theme support --- lisp/tool-bar.el | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 20efddb..5a466bf 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -211,25 +211,48 @@ To define items in any other map, use `tool-bar-local-item'." (apply #'tool-bar-local-item icon def key tool-bar-map props) (tool-bar--flush-cache)) +(defcustom tool-bar-icon-style 'tango + "Specify icon style to use in tool-bar. +Possible values are `tango' and `classic'. + +If Emacs supports GTK it will use current icon theme. + +This variable should be set in your `early-init.el'." + :type 'symbol + :group 'frames) + (defun tool-bar--image-expression (icon) "Return an expression that evaluates to an image spec for ICON." (let* ((fg (face-attribute 'tool-bar :foreground)) (bg (face-attribute 'tool-bar :background)) (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) (if (eq bg 'unspecified) nil (list :background bg)))) - (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) + (xpm-spec (list :type 'xpm :file + (concat (if (eq tool-bar-icon-theme 'tango) "tango/") + icon + ".xpm"))) (xpm-lo-spec (list :type 'xpm :file (concat "low-color/" icon ".xpm"))) (pbm-spec (append (list :type 'pbm :file - (concat icon ".pbm")) colors)) + (concat (if (eq tool-bar-icon-theme 'tango) "tango/") + icon + ".pbm")) colors)) (xbm-spec (append (list :type 'xbm :file (concat icon ".xbm")) colors)) (png-spec (append (list :type 'png :file - (concat icon ".png")) colors))) + (concat (if (eq tool-bar-icon-theme 'tango) "tango/") + icon + ".png")) colors)) + (svg-spec (append (list :type 'svg :file + (concat (if (eq tool-bar-icon-theme 'tango) "tango/") + icon + ".svg")) colors))) `(find-image (cond ((not (display-color-p)) ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)) ((< (display-color-cells) 256) ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)) + ((fboundp 'svg-image) + ',(list png-spec xpm-spec pbm-spec xbm-spec svg-spec)) (t ',(list png-spec xpm-spec pbm-spec xbm-spec))) t))) -- 2.44.0.windows.1 --=-=-=--