desktop-edit

Crates.iodesktop-edit
lib.rsdesktop-edit
version0.1.1
created_at2025-11-24 14:02:51.002395+00
updated_at2025-12-08 02:47:08.824027+00
descriptionA lossless parser and editor for .desktop files
homepagehttps://github.com/jelmer/desktop-edit-rs
repository
max_upload_size
id1947915
size55,125
Jelmer Vernooij (jelmer)

documentation

README

desktop-edit

A lossless parser and editor for .desktop files as specified by freedesktop.org Desktop Entry Specification.

This library preserves all whitespace, comments, and formatting while providing a structured way to read and modify .desktop files.

Features

  • Lossless parsing: All whitespace, comments, and formatting are preserved
  • FreeDesktop .desktop file support: Full support for the freedesktop.org Desktop Entry specification
  • Locale support: Handle localized keys like Name[de]=...

Example

use desktop_edit::Desktop;
use std::str::FromStr;

# let input = r#"[Desktop Entry]
# Name=Example Application
# Type=Application
# Exec=example
# Icon=example.png
# "#;
# let desktop = Desktop::from_str(input).unwrap();
# assert_eq!(desktop.groups().count(), 1);
# let group = desktop.groups().nth(0).unwrap();
# assert_eq!(group.name(), Some("Desktop Entry".to_string()));

License

Apache-2.0

Commit count: 0

cargo fmt