what module can be helpful to find program icon real path based on such as program 'class'?

UPDATE

I try perl module 'FreeDesktop::Icons', it's far behind python 'gi', what I expect is the same work as

import 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 ""
what perl do with
use FreeDesktop::Icons; my $iconlib = new FreeDesktop::Icons; $iconlib->theme('WhiteSur-red'); $iconlib->size('16'); my $imagefile = $iconlib->get('xfsm-shutdown'); print $imagefile;
it's slow and inadequate. Many perl module just fill up CPAN, and help little.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.