what module can be helpful to find program icon real path based on such as program 'class'?
UPDATEI try perl module 'FreeDesktop::Icons', it's far behind python 'gi', what I expect is the same work as
what perl do withimport gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk def resolveIconPath(iconName): iconTheme = Gtk.IconTheme.get_default() iconFile = iconTheme.lookup_icon(iconName.lower(), 32, 0) if iconFile: return iconFile.get_filename() else: return ""
it's slow and inadequate. Many perl module just fill up CPAN, and help little.use FreeDesktop::Icons; my $iconlib = new FreeDesktop::Icons; $iconlib->theme('WhiteSur-red'); $iconlib->size('16'); my $imagefile = $iconlib->get('xfsm-shutdown'); print $imagefile;
CLOSED
There are some solutions, use some 'gtk-icon query <theme> <icon>' command line tool(there are none), or parse icon-theme.cache.Since I only need program icon svg,just get into the dir, and find existed matched file. perl module Gtk3 didnot help, there is no module provide 'lookup_icon' method.
sub findsvg { my $app = shift; my @themes = ("hicolor/scalable/apps/", "Flat-Remix-Blue-Dark/apps +/scalable/", "Papirus/32x32/apps/"); my $svg; foreach my $theme (@themes){ $svg = "/usr/share/icons/" . $theme . $app . ".svg"; -e $svg and return $svg; } return "/usr/share/icons/whiskermenu-manjaro.svg"; }
In reply to resolve current theme icon path by vincentaxhe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |