rust-xdg icon indicating copy to clipboard operation
rust-xdg copied to clipboard

Feature Request: Icon Themes

Open bollian opened this issue 4 years ago • 4 comments

I'm currently running into an issue in a personal project of mine where I want to load icons based on the user-selected theme, but there don't seem to be any good rust crates for doing this. Could this crate accommodate this use-case, given that it's an XDG standard (https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html)?

I don't expect this library to load the images itself. I'm more interested in locating icon file paths by name, and potentially implementing the caching rules discussed in the standard.

I didn't notice anything in the above link specifying exactly where the name of the icon theme is stored, so that might be a barrier to implementation, but seemingly neither GTK or Qt have a problem with this.

bollian avatar Mar 31 '20 20:03 bollian

This is in scope for the xdg crate, and I encourage you to contribute the code to do that.

whitequark avatar Mar 31 '20 20:03 whitequark

So I'm definitely willing to work on this. After looking into it further, implementing this is going to require the ability to parse desktop entry files (https://specifications.freedesktop.org/desktop-entry-spec/latest/). I did find the ini crate out there, but I think the desktop entry specification has enough special stuff in there to justify rolling a specialized parser.

It's actually a semi-interesting problem. The .theme icon theme files, along with the other iterations of desktop entry files, all seem to follow the same format, but have different schemas. It'd be nice to have a single parser that can then be applied to all the different use-cases.

bollian avatar Apr 01 '20 17:04 bollian

I agree that a specialized parser makes sense here.

whitequark avatar Apr 01 '20 19:04 whitequark

How about a feature flag for xdg icon-theme that will use a separate module to parse the theme files. The theme path should be in the default crate.

TimTheBig avatar May 26 '24 23:05 TimTheBig