| Crates.io | freedesktop-apps |
| lib.rs | freedesktop-apps |
| version | 0.0.3 |
| created_at | 2025-09-16 01:09:15.85866+00 |
| updated_at | 2025-09-23 03:53:11.571246+00 |
| description | Rust implementations of the freedesktop standards |
| homepage | https://github.com/javif89/freedesktop |
| repository | https://github.com/javif89/freedesktop |
| max_upload_size | |
| id | 1840753 |
| size | 89,198 |
Parse and execute desktop applications according to the freedesktop Desktop Entry Specification.
.desktop filesuse freedesktop_apps::ApplicationEntry;
// List all installed applications
for app in ApplicationEntry::all() {
if app.should_show() {
println!("{}: {}", app.id().unwrap(), app.name().unwrap());
}
}
let app = ApplicationEntry::try_from_path("/usr/share/applications/firefox.desktop")?;
println!("Name: {}", app.name().unwrap());
println!("Description: {}", app.comment().unwrap_or_default());
println!("Categories: {:?}", app.categories());
println!("Terminal app: {}", app.terminal());
// Execute with no arguments
app.execute()?;
// Execute with files
app.execute_with_files(&["/path/to/file.txt"])?;
// Execute with URLs
app.execute_with_urls(&["https://example.com"])?;
Supports all standard field codes:
%f - Single file%F - Multiple files%u - Single URL%U - Multiple URLs%i - Icon (--icon iconname)%c - Translated name%k - Desktop file location// Get localized strings with fallback
let name = app.get_localized_string("Name", Some("es_ES"));
// Falls back: es_ES → es → default