No description
Find a file
Blaž Čulina 9c562fe3ec fix: use elapsed() instead of inverted duration_since check
The cache retry logic had last_check.duration_since(Instant::now()) which
is backwards - duration_since computes self - earlier, so past.duration_since(future)
always returns Duration::ZERO (saturates to 0). This caused icons marked NotFound
to never be retried, breaking the intended 5-second retry window.

Using last_check.elapsed() is equivalent to Instant::now().duration_since(last_check)
and correctly measures how much time has passed since the cache entry was created.
2026-04-14 15:28:23 +02:00
benches chore: remove linicon dev-dependency 2025-12-02 20:29:34 +01:00
src fix: use elapsed() instead of inverted duration_since check 2026-04-14 15:28:23 +02:00
.gitignore improv: significant memory and cpu usage reduction 2025-01-23 12:03:09 +01:00
Cargo.toml chore: remove linicon dev-dependency 2025-12-02 20:29:34 +01:00
LICENSE chore: add LICENSE 2022-05-13 11:18:22 +02:00
README.md docs: add crates.io and docs.rs badges 2022-05-17 07:16:01 +02:00

freedesktop-icons

crates.io-badge docrs-badge

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::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::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::lookup;

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