**Core Question:**

How to turn mimetype - `image/png` in to actual path to an icon file - `/usr/share/icons/Menda-Circle/mimetypes/24x24/application-image-png.svg`

while respecting linux distros DE's icon theme set?

---

**Own Progress:**

mimetypes.guess\_type() will get me easily mimetype of a file based on the filename which is OKish.

Whats not so easy is translating that mimetype in to a path that leads to an icon

so far I had no luck progressing with linux own xdg-utils, or pyxdg in detecting icon theme or moving beyond that.
PyQt5 seems to have trouble as well, which is understandable when most DEs are not Qt based. Maybe on KDE it will get something.

So with some googling I can use this to detect icon theme through Gtk

```
from gi.repository import Gtk
print(Gtk.Settings.get_default().get_property("gtk-icon-theme-name"))

```

Well thats where I am now, and I guess with some work and adjusting for all cases I could come up with some function to get the icons on most common distros/DE and for most common icon themes. Assuming I figure out the patern translating mimetype in to an icon file name.

But this all feels like it should be done and done already. That its some freedesktop standard and every file manager or any program with a file picker or displaying of files and folders is using this functionality no? 

Is there some nice elegant way to go about this?