Expand description

Icon finder

This is the rustification of the example psuedo code for finding icons a.k.a “the algorithm described in the Icon Theme Specification

Structs

A simple structure to hold directory and theme list.

Functions

Check to see if the sub directory size is in range

You guessed it more pseudo code that turned into rust

In some cases you don’t always want to fall back to an icon in an inherited theme. For instance, sometimes you look for a set of icons, preferring any of them before using an icon from an inherited theme. To support such operations implementations can contain a function that finds the first of a list of icon names in the inheritance hierarchy. This is that function!

This can be very useful, for example, when handling mime type icons, where there are more and less “specific” versions of icons.

Get a DirList struct when we look for a theme name in the Vec<DirList> we send in, and return our Vector when we are done looking in it.

Icon Lookup

the “helper” function from the free desktop example pseudo code

Make the list of DirList structures by reading the $XDG_DATA_DIRS/icons

Look in the basic icon directories (like /us/share/pixmaps, /usr/share/icons) for anything that matches the icon name!

One of the “following helper functions”

This function looks in the ini files of KDE and GTK to find the icon theme!