freedesktop-core 0.0.3

Rust implementations of the freedesktop standards
Documentation
  • Coverage
  • 12.5%
    1 out of 8 items documented0 out of 6 items with examples
  • Size
  • Source code size: 7.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.32 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • javif89/freedesktop
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • javif89

freedesktop-core

Core freedesktop utilities for XDG base directories and desktop environment detection.

Features

  • XDG Base Directory discovery - Find standard data, config, and cache directories
  • Desktop environment detection - Identify the current desktop environment
  • Cross-platform - Works on Linux, BSD, and other Unix-like systems

Usage

use freedesktop_core::{base_directories, current_desktop};

// Get XDG data directories
for dir in base_directories() {
    let apps_dir = dir.join("applications");
    if apps_dir.exists() {
        println!("Applications directory: {}", apps_dir.display());
    }
}

// Detect desktop environment
if let Some(desktop) = current_desktop() {
    println!("Running on: {}", desktop);
}

XDG Specification

This crate implements the XDG Base Directory Specification:

  • Uses XDG_DATA_DIRS environment variable (defaults to /usr/local/share:/usr/share)
  • Uses XDG_DATA_HOME environment variable (defaults to ~/.local/share)
  • Respects XDG_CURRENT_DESKTOP for desktop environment detection