table of contents
| XDG-UTILS-COMMON(7) | xdg-utils Common Manual | XDG-UTILS-COMMON(7) |
NAME¶
xdg-utils-common - Shared functionality of the xdg-utils scripts.
DESCRIPTION¶
The xdg-utils package is a set of scripts that provide basic desktop integration functions for any Free Desktop on Linux, the BSDs and even partially on MacOS and WSL.
Available xdg-utils are:
This manual describes mechanisms that are shared across all or multiple of the xdg-utils.
EXIT CODES¶
All xdg-utils share a common set of exit codes.
0
1
2
3
4
5
6
For debugging have a look at the environment variables and the tool specific manual.
Exit codes not documented here or in a tool specific manual can be considered bugs.
MECHANISMS¶
This chapter will explain different mechanisms under the hood of the xdg-utils.
Desktop Environment Detection (detectDE)¶
The xdg-utils often try to delegate tasks to desktop specific tools to make things work, be consistent with the desktops native applications and a slight performance gain over the shell scripts.
To achieve this, they try to figure out which environment they are in by evaluating XDG_CURRENT_DESKTOP, the output of uname and the existence of specific files.
Currently recognized desktop environments are:
Recognized environments that aren't directly related to a desktop are:
Realpath¶
Turning a relative path into an absolute one in a shellscript seems simple. Until one realizes that the safe way to call gnu realpath is not compatible with busybox realpath and sometimes readlink -f is the appropriate tool.
While this mechanism is used by most xdg-utils it is documented in xdg-realpath(1).
ENVIRONMENT¶
These environment variables work across all xdg-utils and are mostly intended for debugging purposes. If you have to set these to work around a problem please file a bug report.
XDG_UTILS_DEBUG_LEVEL
XDG_UTILS_INSTALL_MODE
See xdg-desktop-icon(1), xdg-icon-resource(1) and xdg-desktop-menu(1).
XDG_UTILS_REALPATH_BACKEND
XDG_CURRENT_DESKTOP
XDG_UTILS_OVERRIDE_DE, XDG_UTILS_<TOOL>_OVERRIDE_DE
To target a specific tool replace <TOOL> with the upper-cased name of the tools command without the xdg- prefix. For xdg-open one would set the variable XDG_UTILS_OPEN_OVERRIDE_DE.
It is very easy to break the xdg-utils using this feature!
If you are using it outside of testing and development you are probably working around a bug. Please report this as an issue to the developers.
REPORTING ISSUES¶
The xdg-utils combine multiple other tools that have had bug in the past, before reporting a bug please check if the bug is caused by a tool used in the xdg-utils. (When unsure please report it anyway) The tool specific manuals may contain hints on how to find out.
In case an issue specific to xdg-utils please report it to https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues .
Please help the developers with information on how to reproduce the issue, it will increase the chance of a timely fix.
Have a patch? Great, but please don't forget to include information on what behavior you are trying to fix. The xdg-utils have a bad habit of disguising one problem as a different one.
AUTHOR¶
Slatian <baschdel+xdg-utils@disroot.org>
COPYRIGHT¶
Copyright © 2024-04-27
NOTES¶
- 1.
- toolbx
- 2.
- Desktop Entry Specification
| 03/11/2026 | xdg-utils 1.2 |