~kitsu


#3 Batch icon lookup 10 months ago

Ticket created by ~kitsu on ~zethra/linicon

Correct me if I'm wrong, but it seems there's quite an amount of duplicated work performed if multiple icons are queried. It would be nice, if that state can be reused somehow (e.g. index parsed only once).

I don't have any benchmarks, but for my case I need to get path to every available icon on the system. Here's the code if you interested, though it doesn't use linicon (at least yet). It loads all available icons once at startup and then display list of installed applications with related icons. Maybe it just a bad fit for the crate?

#2 Unset XDG_DATA_DIR isn't handled properly 10 months ago

Comment by ~kitsu on ~zethra/linicon

Perhaps xdg crate could be used for that?

#2 Unset XDG_DATA_DIR isn't handled properly 10 months ago

Ticket created by ~kitsu on ~zethra/linicon

Here the problem line: https://git.sr.ht/~zethra/linicon/tree/master/src/lib.rs#L54

And the spec states:

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.

#1 Endless loop on non-existent icon 10 months ago

Comment by ~kitsu on ~zethra/linicon

That was fast, thanks!

#1 Endless loop on non-existent icon 10 months ago

Ticket created by ~kitsu on ~zethra/linicon

The following code never stops (assuming there's no icon with name "any-non-existent-icon"):

let icon = linicon::lookup_icon("any-non-existent-icon")
    .use_fallback_themes(false)
    .filter_map(|icon| icon.map_err(|e| eprintln!("linicon failed: {:?}", e)).ok())
    .next()
    .unwrap();
println!("found icon: {:?}", icon);

And the error messages for me are: linicon failed: ThemeNotFound("Adwaita")

I'm not sure whether it's an intended behavior or not, but that was quite surprising to find. I believe it's better to stop iterator when an unrecoverable error occurred.