Icon from Icon Theme overrides my own icon



Hello List,

I have a problem with how the correct icon is chosen for display in my
shell extension. The original github issue is [1].

There are two icon files involved:
1. /usr/share/icons/hicolor/scalable/apps/syncthing.svg
2.
~/.local/share/gnome-shell/extensions/syncthingicon@jay strict posteo de/icons/syncthing-logo-symbolic.svg

Note that both filenames have the same prefix "syncthing", but the
second filename also has "-logo-symbolic" as an infix.


In the extension, the second location is correctly added to the icon
search path with
IconTheme.get_default().append_search_path(`${extension.path}/icons`);

Then the extension creates a new PanelMenu.Button and sets its icon by
creating an
St.Icon({ icon_name: "syncthing-logo-symbolic", ...});

So I would suspect that the displayed icon is icon No. 2
(syncthing-logo-symbolic.svg), but instead the first icon
(syncthing.svg) is incorrectly displayed. Only when I delete the first
icon, the correct one is displayed instead.
The icon search algorithm seems so truncate the filename at the first
"-" character, when it searches for a suitable icon file.

Even if I modify the append_search_path() into a prepend_search_path()
invocation, still the wrong icon is displayed.

Why is the icon file name truncated at the "-" character, and how do I
display the correct icon in my extension?

(An obvious workaround would be to rename the icon to something unique
like a random string like "lajdf908a3r", but I would like to learn the
proper solution for this problem.)


Thank you

Jay Strict



[1] https://github.com/jaystrictor/gnome-shell-extension-syncthing/issues/41


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]