| Crates.io | tux-icons |
| lib.rs | tux-icons |
| version | 0.4.4 |
| created_at | 2024-09-11 20:50:12.338918+00 |
| updated_at | 2025-05-11 19:16:15.301311+00 |
| description | A library for getting desktop icons in linux |
| homepage | |
| repository | https://github.com/Whiskers-Apps/tux-icons |
| max_upload_size | |
| id | 1372261 |
| size | 58,344 |
Tux-Icons is a library for getting icons from an icon pack in linux. You can search using the icon pack and the icon name or just simply getting it from the desktop file.
To install do this in your project:
cargo add tux-icons
Or add it manually in cargo.toml:
[dependencies]
tux-icons = "0.4.4"
Start by creating a IconFetcher instance. This will load with the default system icon pack:
let fetcher = IconFetcher::new();
You can get the icon path just by searching from it's name. For example firefox:
let path = fetcher.get_icon_pack_path("firefox");
You can also get the icon by giving the desktop file path
let path = fetcher.get_icon_path_from_desktop(&desktop_path);
You can also change the icon pack to get an icon from that specific one in case you don't want the default.
fetcher.set_icon_pack("Papirus-Dark");
In case you want to get the target path from the icon file symlink instead of the symlink file
fetcher.set_return_target_path(true);
To install it you can run
cargo install
Or you can install by download the binary in the releases
To use this it's as simple as running search-icon and icon name and from-desktop with .desktop file.
You can also run tux-icons --help for more configurations like icon pack and return target path in case it's a symlink (it's not on by default due to performance reasons).