all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Elijah G." <eg642616@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: casouri@gmail.com,  emacs-devel@gnu.org,  luangruo@yahoo.com
Subject: Re: Add Tango and Adwaita icons for the toolbar
Date: Fri, 10 May 2024 09:43:26 -0600	[thread overview]
Message-ID: <86zfsxy8o1.fsf@gmail.com> (raw)
In-Reply-To: <861q6a5eof.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 May 2024 10:06:24 +0300")

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Elijah G." <eg642616@gmail.com>
>> Cc: <emacs-devel@gnu.org>,  Po Lu <luangruo@yahoo.com>
>> Date: Thu, 09 May 2024 20:04:03 -0600
>> 
>> > We also need some way to opt-out of the new icons. I’ll try to figure
>> > it out.
>> 
>> 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) "tango/")
>> +                                 ".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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: FIXED PATCH --]
[-- Type: text/x-patch, Size: 2976 bytes --]

From 49019a3938269ae2ecf7e55df943e6808fb86eb6 Mon Sep 17 00:00:00 2001
From: "Elias G. Perez" <eg642616@gmail.com>
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


  reply	other threads:[~2024-05-10 15:43 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-05  4:07 Add Tango and Adwaita icons for the toolbar Elijah G
     [not found] ` <15F31342-2F2E-4F1E-9FE2-D8F1A62BCC5A@gmail.com>
2024-05-05  7:06   ` Yuan Fu
2024-05-05  8:07   ` Po Lu
2024-05-06  0:10     ` Yuan Fu
2024-05-06  5:10   ` Elijah G
2024-05-06  5:32     ` Yuan Fu
2024-05-07  4:18       ` Elijah G
2024-05-08  0:22         ` Yuan Fu
2024-05-08  3:19           ` Elijah G
2024-05-09  3:52           ` Elijah G
2024-05-09  4:50             ` Yuan Fu
2024-05-10  2:04               ` Elijah G.
2024-05-10  7:06                 ` Eli Zaretskii
2024-05-10 15:43                   ` Elijah G. [this message]
2024-05-16  5:54                     ` Yuan Fu
2024-05-09  5:28             ` Redo button on the tool bar Eli Zaretskii
2024-05-09 15:49               ` Elijah G.
2024-05-09 15:56                 ` Elijah G.
2024-05-09 16:41                 ` Eli Zaretskii
2024-05-09 18:00                   ` Dmitry Gutov
2024-06-28  2:24 ` Add Tango and Adwaita icons for the toolbar Elijah G.
2024-06-28  4:36   ` Yuan Fu
2024-06-28  9:22     ` Po Lu
     [not found] <EDDF7D6A-E818-483A-AA98-CB2D093BCDAC@gmail.com>
2024-05-04  9:48 ` Po Lu
2024-05-04 16:42   ` Yuan Fu
2024-05-05  0:22     ` Po Lu
2024-05-05  3:04       ` Yuan Fu
2024-05-05  4:14         ` Po Lu
2024-05-05  6:59           ` Yuan Fu
2024-05-05  6:01         ` Eli Zaretskii
2024-05-05  6:39           ` Po Lu
2024-05-05  5:55       ` Eli Zaretskii
2024-05-04 12:27 ` Eli Zaretskii
2024-05-04 21:27   ` Yuan Fu
2024-05-05  0:08     ` Po Lu
2024-05-05 15:42       ` Dmitry Gutov
2024-05-06  3:01         ` Yuan Fu
2024-05-05  5:33     ` Eli Zaretskii
2024-05-05  6:41       ` Po Lu
2024-05-05  7:03         ` Yuan Fu
2024-05-05  8:04           ` Po Lu
2024-05-05  9:10           ` Eli Zaretskii
2024-05-06  2:58             ` Yuan Fu
2024-05-06 11:00               ` Eli Zaretskii
2024-05-06 11:24                 ` Po Lu
2024-05-08  0:25                 ` Yuan Fu
2024-05-08  1:38                   ` Dmitry Gutov
2024-05-08  3:55                     ` Po Lu
2024-05-08 13:44                       ` Dmitry Gutov
2024-05-05 17:06         ` Max Nikulin
2024-05-05 15:25 ` Dmitry Gutov
2024-05-05 23:01 ` Rudolf Adamkovič

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zfsxy8o1.fsf@gmail.com \
    --to=eg642616@gmail.com \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.