#icons #desktop #linux #pack #file #getting #search

bin+lib tux-icons

A library for getting desktop icons in linux

7 releases

new 0.3.1 Nov 18, 2024
0.3.0 Oct 10, 2024
0.2.3 Oct 9, 2024
0.2.2 Sep 21, 2024
0.1.1 Sep 11, 2024

#484 in Filesystem

Download history 157/week @ 2024-09-06 42/week @ 2024-09-13 291/week @ 2024-09-20 25/week @ 2024-09-27 235/week @ 2024-10-04 80/week @ 2024-10-11 7/week @ 2024-10-18 2/week @ 2024-10-25 2/week @ 2024-11-01 131/week @ 2024-11-15

136 downloads per month
Used in whiskers-launcher-core

MIT license

61KB
253 lines

About

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.

Install

To install do this in your project:

cargo add tux-icons

Or add it manually in cargo.toml:

[dependencies]
tux-icons = "0.3.1"

Usage

Start by creating a IconFetcher instance. This will load with the default system icon pack:

let fetcher = IconFetcher::new();

Get the icon path given it's name

You can get the icon path just by searching from it's name. For example firefox:

let path = fetcher.get_icon_pack_path("firefox");

Get icon path from desktop file

You can also get the icon by giving the desktop file path

let path = fetcher.get_icon_path_from_desktop(&desktop_path);

Use other icon pack

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");

Get target path

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);

Dependencies

~14–23MB
~144K SLoC