desktop-file-validate
Validate desktop entry files
SYNOPSIS
desktop-file-validate [OPTIONS...] FILE...
PARAMETERS
FILE...
One or more paths to the .desktop
files to be validated.
--no-warn-kde
Do not emit warnings about unofficial KDE extensions found in the desktop file. These extensions are often non-standard but widely used in KDE environments.
--no-warn-gnome
Do not emit warnings about unofficial GNOME extensions found in the desktop file. These extensions are often non-standard but widely used in GNOME environments.
--warn-strict
Emit warnings about all unofficial keys, including those that might otherwise be silently ignored. This option enforces stricter compliance with the specification.
--version
Display the version information of the desktop-file-validate
command and exit.
--help
Display a brief help message explaining the command's usage and options, then exit.
DESCRIPTION
desktop-file-validate
is a utility used to check the syntax and compliance of .desktop
files against the Desktop Entry Specification from freedesktop.org. These files, typically ending with the .desktop
extension, are fundamental components for desktop environments like GNOME, KDE, and XFCE. They define how applications, URLs, or directories are represented in application menus, desktop launchers, and file managers.
The validation process ensures that the file adheres to the specified format, checks for mandatory keys, correct value types, proper escaping, and common errors that could lead to misbehavior or improper display of the entry. By using desktop-file-validate
, developers and users can confirm that their .desktop
files will function as expected, providing a smooth integration into the desktop environment and preventing issues like missing icons, incorrect command execution, or malformed entries in application menus. It's an essential tool for maintaining the integrity and usability of desktop entries.
CAVEATS
The tool validates against the Desktop Entry Specification version it was built to support, which may not always be the absolute latest version. While comprehensive for syntax and specification compliance, it may not catch all possible runtime issues or subtle semantic errors that could arise in a specific desktop environment's implementation. Warnings for unofficial extensions (KDE/GNOME) can be suppressed, but their presence might indicate non-standard behavior on other desktops.
EXIT STATUS
The desktop-file-validate
command returns an exit status of 0 if all specified desktop files are found to be valid according to the Desktop Entry Specification and no errors or strict warnings occurred. A non-zero exit status (typically 1) indicates that one or more files failed validation, meaning errors or significant warnings were detected. This makes it suitable for use in build systems and automated scripts to ensure the quality of desktop entries.
SPECIFICATION COMPLIANCE
The utility ensures compliance with the Desktop Entry Specification (currently version 1.1 or 1.2, depending on the desktop-file-utils
version). This specification defines the structure, keys, and values for .desktop
files, covering aspects like application name, command to execute, icon, categories, and localization. Validation checks for missing required keys, incorrect data types, malformed URLs, improper escaping, and other common pitfalls that can lead to broken or non-functional desktop entries.
HISTORY
desktop-file-validate
is part of the desktop-file-utils
package, which provides a set of utilities for working with freedesktop.org desktop entries. Its development was driven by the need for a standardized way to define applications and their properties across various Linux desktop environments like GNOME, KDE, and XFCE. This standardization, primarily through the Desktop Entry Specification, ensures interoperability and consistent user experience. The command has been a staple tool for developers and package maintainers since the early 2000s, helping to enforce the specification and prevent malformed desktop entries from being deployed.
SEE ALSO
update-desktop-database(1), xdg-open(1), xdg-desktop-menu(1)