[−][src]Function linicon::lookup_icon
pub fn lookup_icon<'a>(icon_name: impl AsRef<str>) -> IconIter<'a>ⓘ
Lookup icons with by name, size, and scale in the given theme or one of its fallbacks.
By default, if the system-theme
feature is enabled (on by default) this
will search through the user's icon theme if it can be determined.
Otherwise, it will search through the default theme hicolor
. To search
through a specific theme, use
IconIter::from_theme
.
As per the FreeDesktop Icon Theme specification, linicon will search for icon themes the the following directories in order:
$HOME/.icons
$XDG_DATA_DIRS/icons
(each path in list followed by/icons
)/usr/share/pixmaps
If you need to specify additional search paths use
IconIter::with_extra_paths
Returns
Returns an iterator over any matching icons. The iterator return matching
icons in any fallback themes after ones in the main theme are exhausted unless
IconIter::use_fallback_themes
is used.
Errors
The iterator may return an error if:
- The selected theme isn't installed(correctly)
- There is an error parsing a theme's index file
- Finding a fallback theme fails
- The above for getting the fall theme
Note: The iterator will return None
after an error.
Examples
Find an icon for Wireshark.
let wireshark_icon = linicon::lookup_icon("wireshark").next(); println!("{:?}", wireshark_icon);
Find all of the icons for Wireshark from the Faenza theme with a size of 64 and a 1x scale.
use linicon::lookup_icon; let wireshark_icons: Vec<_> = lookup_icon("wireshark") .from_theme("Faenza") .with_size(64) .with_scale(1) .use_fallback_themes(false) .collect(); println!("{:#?}", wireshark_icons);