-
-
Notifications
You must be signed in to change notification settings - Fork 899
Modules DE
Print desktop environment name
| Module type | de |
| Default order | 21 (only used by --gen-config) |
| Module source | src/modules/de/de.c |
| Detection source |
src/detection/displayserver/ (the name), src/detection/de/de_linux.c (the version) |
Prints the desktop environment that owns the current session, with its version when one could be determined.
Desktop Environment: KDE Plasma 5.27.5
Desktop Environment: GNOME 44.1
Desktop Environment: Xfce4 4.18
Desktop Environment: COSMIC 0.1.0
The module exists everywhere, but the two halves have different reach: the name comes from the
display-server layer, and the version comes from src/detection/de/.
| Platform | DE name | DE version |
|---|---|---|
| Linux | displayserver_linux.c |
de_linux.c |
| Android | displayserver_android.c |
de_linux.c |
| FreeBSD / NetBSD / OpenBSD | displayserver_linux.c |
de_linux.c |
| Solaris / illumos | displayserver_linux.c |
de_linux.c |
| GNU/Hurd | displayserver_linux.c |
de_linux.c |
| Haiku | displayserver_haiku.cpp |
de_nosupport.c |
| macOS | displayserver_apple.c |
de_nosupport.c |
| Windows | displayserver_windows.c |
de_nosupport.c |
de_nosupport.c is registered in the Haiku, macOS and Windows blocks, so the module always
reports No DE found on those three — the display-server layer there knows a window manager
but never a desktop environment. This is the mirror image of the WM module, which is
unsupported on Solaris and Haiku instead.
| Key | Type | Default | Description |
|---|---|---|---|
key |
string | module name | Module key. A single space hides the key and the separator. |
keyColor |
color | – | Overrides display.color.keys. |
keyWidth |
integer | – | Overrides display.key.width. |
keyIcon |
string | built-in glyph | Printed when display.key.type includes the icon bit. Any glyph works; "" prints none. |
outputColor |
color | – | Overrides display.color.output. |
format |
string | – | Custom output format (see below). |
condition |
object | – | Show the module only if the conditions match. |
There are no module-specific keys. Version detection is controlled by the global
general.detectVersion setting.
slowVersionDetection is accepted but rejected: passing it prints
Key slowVersionDetection is deprecated, it's always true and the module continues. The key
dates from when version detection was opt-in; it is now unconditional.
Run fastfetch -h de-format for the authoritative list.
| Variable | Description |
|---|---|
{process-name} |
The session process, e.g. plasmashell or gnome-shell
|
{pretty-name} |
The display name, e.g. KDE Plasma
|
{version} |
Version string, when one could be determined |
{pretty-name} is not always a recognised desktop environment: when nothing matches, the
value of XDG_CURRENT_DESKTOP (or one of its four fallbacks) is used verbatim, so
{pretty-name} can be COSMIC, TDE or any custom string.
On failure the object is { "type": "DE", "error": "No DE found" }.
{ "type": "de", "key": "DE", "format": "{pretty-name} {version}" }{ "type": "de", "format": "{process-name}" }-
Only three platforms can find a DE at all. macOS, Windows and Haiku always print
No DE found, because no desktop environment is detectable there — only a window manager. A format string that assumes{pretty-name}is non-empty will render blank on those. -
Four recognised names never get a version. Measured against the real dispatch table,
CDE,UKUI,LXDEandNebiDEall returnUnsupported DEand leave{version}empty.CDEandUKUIare produced by the display-server layer's pretty-name table;LXDEandNebiDEhave constants defined for them but no mapping, so they only appear whenXDG_CURRENT_DESKTOPhappens to spell them that way.GNOME Classicused to be on this list and is not any more — it isGNOMEwithGNOME_SHELL_SESSION_MODE=classic, so the version branch now routes it to the samegnome-shellprobe as plainGNOME. -
Trinity is matched case-insensitively and accepts two spellings. The display-server layer
produces
TrinityfromTDE_FULL_SESSIONandTDEfromXDG_CURRENT_DESKTOP, so the dispatch compares against both, ignoring case. Measured:Trinity,trinityandTDEall reach the version probe; only the rawtde-configoutput decides whether{version}ends up non-empty. Note thatTDEis the display-server spelling, while{pretty-name}may still render something else. -
{version}is empty for anything not on the list. The version probe is a fixedif/else ifchain over twelve names; anything else — including every customXDG_CURRENT_DESKTOPvalue — silently reports no version and no error. -
Version detection runs external commands. For KDE, GNOME (and GNOME Classic), Cinnamon,
Xfce4, Mate, LXQt, COSMIC and Enlightenment the probe falls back to running the session binary
with
--version(and Trinity withtde-config --version) when the file-based probes come up empty.xfce4-session --versionandlxqt-session -vare noted in the source as particularly slow. Setgeneral.detectVersiontofalseto keep fastfetch side-effect free. -
The version can come from a shared library. The Xfce4 probe prefers
dlopen("libxfce4util.so.7")and callsxfce_version_string(); a build withFF_DISABLE_DLOPENskips straight to spawning the binary. -
Some versions are read out of
$HOMEor the environment. Cinnamon reads$CINNAMON_VERSIONfirst, COSMIC reads$COSMIC_VERSIONfirst, and the file-based probes searchXDG_DATA_DIRS(throughffParsePropFileData) rather than fixed paths — so the value reflects the user's environment, not the system package database. -
{process-name}is a hard-coded guess for most DEs. It is not the process that was actually found: the display-server layer sets it to a fixed string such asplasmashell,xfce4-sessionorenlightenment_startwhenever the display name matches. For LXQt it is alwayslxqt-sessioneven though the session may run a different window manager. -
The DE name can come from a window-manager name. If nothing is recognised, the last
fallback assigns
XDG_CURRENT_DESKTOPto whichever of the DE and WM slots is still empty, so a compositor that setsXDG_CURRENT_DESKTOPto its own name shows up as the desktop environment. That is howCOSMICis reported. -
{pretty-name}is the key for everything downstream.wmthemeandgtkcomparedePrettyNameagainst the sameGNOME Classic/NebiDEstrings to decide which theme backend to use, so a customXDG_CURRENT_DESKTOPvalue silently disables those too.
The module itself does no detection: ffPrintDE() asks the display-server layer for the
cached FFDisplayServerResult, errors out when dePrettyName is empty, and then calls
ffDetectDEVersion() to fill {version}.
ffConnectDisplayServer() returns a cached FFDisplayServerResult — the cache is invalidated
at each --dynamic-interval round boundary, so the detection below runs once per round, not
once per process. It populates both deProcessName and dePrettyName. On Linux, Android, BSD
and Solaris the work happens in src/detection/displayserver/linux/wmde.c:
-
parseEnv()readsXDG_CURRENT_DESKTOP,XDG_SESSION_DESKTOP,CURRENT_DESKTOP,SESSION_DESKTOPandDESKTOP_SESSIONin that order, then falls back to probingKDE_FULL_SESSION/KDE_SESSION_UID/KDE_SESSION_VERSION,GNOME_DESKTOP_SESSION_ID,MATE_DESKTOP_SESSION_ID,TDE_FULL_SESSION,HYPRLAND_CMD,SWAYSOCKandCOSMIC_VERSION, plus a/mnt/wslg/check on Linux. -
applyPrettyNameIfDE()matches that value, case-insensitively, against a fixed list and sets both fields. KDE additionally consults$KDEWM, and LXQt readswindow_managerfromlxqt/session.conf, so that the window manager can be resolved before the process scan. - If either field is still empty,
getFromProcesses()walks every process owned by the current user —sysctl({CTL_KERN, KERN_PROC, KERN_PROC_UID})on FreeBSD and NetBSD,KERN_PROC2on NetBSD,/procwithloginuidfiltering on Solaris, and a/procwalk on Linux that prefers/proc/<pid>/exewithbasename()and falls back to/proc/<pid>/comm— applying the same two matchers to each process name. The scan stops as soon as both fields are set. - Whatever is still empty is filled from the environment value, which is how an unrecognised desktop gets reported.
The connection to the display server itself only ever yields a window manager, which is why step 3 exists at all; the module relies on it for the DE half.
ffDetectDEVersion() is a single if/else if chain over the pretty name, gated on
general.detectVersion. Each branch is a short list of file probes followed by a process
invocation:
-
KDE Plasma — reads
X-KDE-PluginInfo-Versionfromplasma.desktop,plasmax11.desktop,plasma5.desktop,plasmawayland.desktoporplasmawayland5.desktop, under<pkg base>/share/wayland-sessions/and<pkg base>/share/xsessions/first and then throughXDG_DATA_DIRS; failing that it runsplasmashell --versionand keeps the last space-separated token.<pkg base>isFF_PATH_PKG_BASE—/usrnormally,/usr/localon FreeBSD and OpenBSD,/usr/pkgon NetBSD. -
GNOME and GNOME Classic — asks the session bus for
org.gnome.Shell.ShellVersionon/org/gnome/Shell, then runsgnome-shell --versionand takes the last token. The D-Bus path is compiled out whenFF_HAVE_DBUSis not defined. GNOME Classic is the same shell in classic mode, so it takes this identical path. -
Cinnamon —
$CINNAMON_VERSION, thenX-GNOME-Bugzilla-Versionfromapplications/cinnamon.desktop, thencinnamon --version. -
Xfce4 —
xfce_version_string()fromlibxfce4util, thenxfce4-session --versionwith the text before the first)and after the last space kept. -
Mate — reads
<platform>,<minor>and<micro>out ofmate-about/mate-version.xmland joins them withffParseSemver(), then falls back tomate-session --version. -
LXQt — three file probes (
gconfig/lxqt.pc,cmake/lxqt/lxqt-config.cmake,cmake/lxqt/lxqt-config-version.cmake), thenlxqt-session -vwith theliblxqtline extracted from its output. -
Budgie — a single read of
budgie/budgie-version.xml, looking for<str>. -
Unity — reads the
version= "%progoption out of the/usr/bin/unityscript and cuts at the first quote. -
COSMIC —
$COSMIC_VERSION, thencosmic-comp --versionwith the second field kept. -
Enlightenment — calls the
Versionmethod onorg.enlightenment.wm.Coreover the session bus, then parsesVersion:out ofenlightenment --version. -
Trinity / TDE — locates
tde-config, derives../lib/libtdecore.sofrom its path and scans that binary for a string matchingR<major>.<minor>.<patch>, then falls back totde-config --versionand looks for aTDE:line. The dispatch reaches this branch for bothTrinityandTDE, ignoring case.
Everything else returns Unsupported DE and leaves the buffer untouched.
{ "type": "DE", "result": { "processName": "plasmashell", "prettyName": "KDE Plasma", "version": "5.27.5" } }