$ show jceb/dex
dex is a command-line utility for managing and executing Desktop Entry files (.desktop files) in Linux desktop environments. It implements the freedesktop.org Desktop Entry Specification to parse, validate, and act upon .desktop files. The tool provides functionality to execute applications from .desktop files, create new .desktop files, query properties of existing files, and manage autostart programs from standard autostart directories. The architecture centers around a well-designed DesktopEntry class that handles parsing and property access, with special attention to proper command-line string parsing in the Application._build_cmd method, which correctly handles quotes, escapes, and desktop-specific field codes. The tool has zero external dependencies, relying only on the Python standard library, and is actively maintained with recent commits and automated testing.
The LLM identified 3 files worth highlighting for reuse:
The DesktopEntry class and its subclasses (Application, Action) provide a complete implementation of the freedesktop.org Desktop Entry Specification for parsing .desktop files. It handles groups, key-value pairs, type validation, and provides property accessors for all standard desktop entry fields. This component is highly reusable for any application needing to read or generate .desktop files.
The Application._build_cmd method expertly parses command-line strings from Desktop Entry Exec fields into subprocess-ready argument lists. It correctly handles quotes, escaped characters, and ignores desktop-specific field codes (%f, %F, etc.) while preserving legitimate percent signs. The method includes comprehensive doctests verifying its correctness across complex quoting scenarios, demonstrating exceptional attention to edge cases that most implementations would miss.
The get_autostart_directories and get_autostart_files functions correctly implement the XDG autostart specification. They locate autostart directories according to XDG standards, handle duplicate files, and properly apply OnlyShowIn/NotShowIn filters based on desktop environment. This component provides a reusable implementation of autostart functionality that adheres to freedesktop.org standards.