freedesktop
Rust implementations of the freedesktop.org specifications for Linux desktop integration.
Quick Start
Add to your Cargo.toml:
[]
= "0.0.3"
XDG Base Directories
use base_directories;
for dir in base_directories
Desktop Applications
use ApplicationEntry;
// List all applications
for app in all
// Parse and execute a desktop file
let app = try_from_path?;
app.execute?;
Icon Themes
use ;
// Get the current system icon theme
let theme = current;
println!;
// Find an icon using the convenience function
if let Some = get_icon
// Search within a specific theme
if let Some = from_name
Features
This crate provides optional features for different functionality:
core(default) - XDG base directories and desktop environment detectionapps(default) - Desktop Entry parsing and application executionicon(default) - Icon theme support and icon lookupcli- Command-line utilities (enablesapps)
Feature Usage
# Default features (core + apps + icon)
= "0.0.3"
# Only XDG base directories
= { = "0.0.3", = false, = ["core"] }
# Only desktop applications
= { = "0.0.3", = false, = ["apps"] }
# Icon theme support
= { = "0.0.3", = false, = ["icon"] }
Standards Compliance
- Spec-compliant - Follows freedesktop.org specifications exactly
- Safe execution - Proper field code expansion and shell escaping
- Comprehensive - Supports localization, terminal apps, working directories
- Well-tested - Extensive test coverage including edge cases
Platform Support
- Linux
- BSD variants
- Other Unix-like systems with XDG support
Development
This library is built as a workspace with the following crates:
- freedesktop-core - XDG base directories and desktop environment detection
- freedesktop-apps - Desktop Entry parsing and application execution
- freedesktop-icon - Icon theme support and icon lookup
License
MIT