#icons #freedesktop #gui

freedesktop-icons-greedy

A Freedesktop Icons lookup crate

3 releases

0.2.6 Jul 25, 2023
0.2.5 Jul 25, 2023
0.2.4 Jul 25, 2023

#17 in #freedesktop

Download history 2/week @ 2024-02-14 15/week @ 2024-02-21 10/week @ 2024-02-28 1/week @ 2024-03-06 4/week @ 2024-03-13 18/week @ 2024-03-27 37/week @ 2024-04-03

55 downloads per month

MIT license

34KB
762 lines

freedesktop-icons-greedy

A fork of freedesktop-icons that resolves icons even when the theme doesn't have an index.

use freedesktop_icons_greedy::lookup;

let icon = lookup("firefox")
    .with_greed()
    .find();

lib.rs:

freedesktop-icons

This crate provides a freedesktop icon lookup implementation.

It exposes a single lookup function to find icons based on their name, theme, size and scale.

Example

Simple lookup:

The following snippet get an icon from the default 'hicolor' theme with the default scale (1) and the default size (24).

use freedesktop_icons_greedy::lookup;

let icon = lookup("firefox").find();

Complex lookup:

If you have specific requirements for your lookup you can use the provided builder functions:

use freedesktop_icons_greedy::lookup;

let icon = lookup("firefox")
    .with_size(48)
    .with_scale(2)
    .with_theme("Arc")
    .find();

Cache:

If your application is going to repeat the same icon lookups multiple times you can use the internal cache to improve performance.

use freedesktop_icons_greedy::lookup;

let icon = lookup("firefox")
    .with_size(48)
    .with_scale(2)
    .with_theme("Arc")
    .with_cache()
    .find();

Dependencies

~2–11MB
~95K SLoC