freedesktop-apps
Parse and execute desktop applications according to the freedesktop Desktop Entry Specification.
Features
- Desktop Entry parsing - Robust parsing of
.desktopfiles - Application execution - Safe launching with field code expansion
- Localization support - Proper locale fallback for names and descriptions
- Terminal applications - Automatic terminal detection and wrapping
- Spec-compliant - Follows Desktop Entry Specification v1.5
Usage
Basic Application Discovery
use ApplicationEntry;
// List all installed applications
for app in all
Application Information
let app = try_from_path?;
println!;
println!;
println!;
println!;
Application Execution
// Execute with no arguments
app.execute?;
// Execute with files
app.execute_with_files?;
// Execute with URLs
app.execute_with_urls?;
Field Code Support
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
Localization
// Get localized strings with fallback
let name = app.get_localized_string;
// Falls back: es_ES → es → default
Safety
- Shell escaping - All arguments are properly escaped
- Input validation - Malformed desktop files handled gracefully
- Process isolation - Applications launched in detached processes
- Error handling - Comprehensive error types for all failure modes