Generated by GPT-5-mini| XDG | |
|---|---|
| Name | XDG |
| Developer | Freedesktop.org and various contributors |
| Released | 2002 |
| Latest release | N/A |
| Programming language | C, Shell, Python, Perl, Rust, Go |
| Operating system | Unix-like |
| License | MIT, BSD, LGPL, custom |
| Website | Freedesktop.org |
XDG
XDG is a suite of conventions and interoperable specifications that standardize runtime directories, configuration locations, desktop entries, and MIME handling for Unix-like desktop environments. It provides a common set of paths, file formats, and behavioral rules intended to enable interoperability between projects such as KDE, GNOME, Xfce, LXDE, Enlightenment, and distribution-level package systems like Debian and Fedora. XDG aims to reduce fragmentation among desktop components including window managers, session managers, file managers, and application launchers.
The XDG collection comprises several named specifications and environment variables originally coordinated through Freedesktop.org, including the Desktop Entry Specification, Icon Theme Specification, MIME Applications Specification, and Base Directory Specification. Key terms include the XDG Base Directory variables such as XDG_CONFIG_HOME, XDG_DATA_HOME, and XDG_CACHE_HOME; the desktop entry file format (.desktop); and the concept of runtime directories (XDG_RUNTIME_DIR) used by systemd, ConsoleKit, PAM, and Wayland compositors. Implementations reference standards maintained by projects like KDE Plasma, GNOME Shell, MATE, Cinnamon, Xfce4-panel, LXQt, and tools such as systemd-logind, Polkit, udisks2, NetworkManager, and PulseAudio.
Origins trace to early coordination efforts on Freedesktop.org to harmonize interoperability between projects including K Desktop Environment, GNOME, X.Org, and XFree86. Contributions and debates occurred among developers affiliated with Red Hat, Novell, Canonical, SUSE, Debian, and individual maintainers of toolkits such as GTK, Qt, and Enlightenment Foundation Libraries. Over time, systemd maintainers and freedesktop contributors formalized runtime concepts influencing projects like Wayland compositors (Weston, Sway), display servers (X.Org Server), and session managers (GDM, SDDM). Historical milestones include adoption by major distributions (Ubuntu, Fedora, openSUSE, Arch Linux), specification expansions to cover menus and autostart handling, and integration with packaging systems and desktop installers used by GNOME Software, Discover, and AppStream.
Prominent specifications in the XDG family include the XDG Base Directory Specification, Desktop Entry Specification, Icon Theme Specification, MIME Applications Specification, Menu Specification, Autostart Specification, and Additional Desktop Actions. They define file formats, priority resolution rules, and lookup order across system and user directories such as /usr/share, /usr/local/share, /etc/xdg, and $HOME/.config. Standards interact with freedesktop.org policies, the AppStream metadata format used by PackageKit and GNOME Software, and with X11/Wayland protocol considerations enforced by compositors like Mutter and KWin. Security and sandboxing considerations reference technologies such as Flatpak, Snap, Bubblewrap, SELinux, AppArmor, and systemd service units when specifying runtime and cache locations.
Implementations span desktop environments, libraries, and utilities. Desktop environments with direct support include KDE Plasma Frameworks (KConfig, KService), GNOME (GLib, GDesktopAppInfo), Xfce (libxfce4ui), LXQt (libqtxdg), MATE, and Enlightenment. Tooling and libraries include libdesktopentries, gio, libxdg-based utilities, xdg-utils wrapper scripts used by browsers (Firefox, Chromium), and package managers like dpkg, rpm, and pacman that place files into XDG-compliant locations. Compositors and session components—Wayland compositors (Sway, Wayfire), X.Org components, login managers (LightDM, GDM), and systemd-logind—consume XDG runtime semantics. Cross-desktop installers and app stores use these specs for icon resolution, MIME registration, and desktop integration.
XDG conventions enable predictable locations for configuration and data enabling backup, roaming, and multi-user installations; they support application launch and menu organization via .desktop files used by menus in GNOME Shell, Plasma, and Xfce4-panel. Icon Theme Specification drives icon lookup for themes like Breeze, Adwaita, Papirus, and Numix; MIME specifications support file association handling in Thunar, Dolphin, Nautilus, PCManFM, and Caja. Runtime directories are used by audio subsystems (PulseAudio, PipeWire), session lock implementations (light-locker), and credential stores (GNOME Keyring, KWallet). App packaging and sandboxing systems such as Flatpak and Snap adapt XDG paths for portal implementations and desktop integration, while installers and configuration management tools reference XDG rules for dotfiles and system-wide defaults.
Critiques focus on inconsistent adoption across legacy software, ambiguity in precedence rules when multiple directories contain resources, and limitations when applied to containerized or mobile environments. Some distributions and projects deviate from freedesktop recommendations, creating fragmentation between DEs and distributions including system-specific overrides by Canonical or Red Hat. Security concerns arise when XDG_RUNTIME_DIR permissions or user-writable system data expose race conditions or symlink attacks; sandboxing approaches like Flatpak and Snap partially mitigate but also complicate desktop integration. Performance issues can occur from large XDG lookup paths, and toolchain differences in libraries (GLib vs Qt) lead to duplicated implementations (libqtxdg, xdg-utils), complicating consistent behavior across applications.
Category:Freedesktop.org standards