-
-
Notifications
You must be signed in to change notification settings - Fork 899
WMTheme
Print the current window manager theme
| Module type | wmtheme |
| Default order | 23 (only used by --gen-config) |
| Module source | src/modules/wmtheme/wmtheme.c |
| Detection source | src/detection/wmtheme/ |
Prints the theme of the window manager that is currently running. The result is one string, not two
parts like Modules/Theme.
WM Theme: Breeze
WM Theme: Adwaita
WM Theme: Custom - Blue (System: Dark, Apps: Dark)
WM Theme: Red (Dark)
| Platform | Implementation | Notes |
|---|---|---|
| Linux | wmtheme_linux.c |
Per-WM: config files, GSettings / DConf, XFConf, GTK theme as a fallback |
| Android | wmtheme_linux.c |
Same file |
| FreeBSD / NetBSD / OpenBSD / DragonFly | wmtheme_linux.c |
Same file |
| Solaris / illumos | wmtheme_linux.c |
Same file |
| GNU/Hurd | wmtheme_linux.c |
Same file |
| macOS | wmtheme_apple.c |
Accent colour plus the interface style |
| Windows | wmtheme_windows.c |
Theme file name, accent colour and the light/dark preference |
| Haiku | wmtheme_haiku.cpp |
DecorInfoUtility::CurrentDecorator() |
Every platform has an implementation.
| Key | Type | Default | Description |
|---|---|---|---|
key |
string | WM Theme |
Module key. A single space hides the key and the separator |
keyColor |
color | – | Overrides display.color.keys
|
keyIcon |
string | built-in glyph | Printed when display.key.type includes the icon bit. Any glyph works; "" prints none. |
keyWidth |
integer | – | Overrides display.key.width
|
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 options.
Run fastfetch -h wmtheme-format for the authoritative list.
| Variable | Description |
|---|---|
{result} |
WM theme |
{result} is not marked * in the help output, so it is not available in the key format. It is the
only variable the module has — the default output and {result} are the same string.
-
resultis a plain string, not an object and not an array — the whole theme is one value. - On failure the object carries
errorinstead and has noresult.
// Hide the module unless a theme was found (an error is invisible by default anyway)
{ "type": "wmtheme", "format": "{?result}{result}{?}" }- The result is a single string, so nothing is structured. There is no way to ask for "just the accent colour" on Windows or "just the style" on macOS through the format string — the module composes one string and hands it over.
-
On Windows the value is not a window-manager theme at all. It is the file name of the active
.themefile (with the extension stripped and the first letter capitalised), optionally followed by- <accent name or #RRGGBB>, optionally followed by(System: Light|Dark, Apps: Light|Dark)fromThemes\Personalize. Each part is skipped when its registry value is missing, soCustom,Custom - BlueandCustom - Blue (System: Dark, Apps: Dark)are all valid shapes. -
The Windows accent colour is a fixed name table, and a hit is a guess. The registry value is
an RGB triple that is looked up in a hard-coded list of about 50 Windows accent colours; a miss
falls back to
#RRGGBB. The same colour can therefore be named on one machine and printed as hex on another if the list drifts from the installed Windows version. -
Windows reports the light/dark preference for two separate things.
SystemUsesLightThemeandAppsUseLightThemeare printed together, because they can disagree; a single "is dark mode on" answer does not exist there. -
WM Theme needs successful WM detectionis the first failure mode on Unix. The module starts fromffDetectWM(); without a window manager name it errors out immediately. A TTY session therefore reports this error rather than a theme. -
Only a fixed list of window managers is supported on Unix.
kwin(config file, defaulting toBreeze),cosmic-comp,xfwm4(andlabwcunder XFCE),mutter(GNOME only — other desktops fall back to the GTK theme),muffin,marco,openboxandenlightenmenthave branches; anything else reportsUnknown WM: <name>. Notablyi3,sway,hyprlandandbspwmare not in the list. -
The Plasma-specific prefixes are stripped.
kwinrc'sthemevalue often carries aqml_orsvg__prefix that Plasma adds internally; both are removed, and the value after the last prefix wins. -
muffincan return two names in one string. When Cinnamon reports bothorg.cinnamon.theme::nameandorg.cinnamon.desktop.wm.preferences::theme, the result is<name> (<theme>); with only one of them set, that one is printed alone. -
COSMIC comp's value is assembled from several files, and includes an accent colour. The
variant comes from
is_dark, the name fromCosmicTheme.<Variant>/v1/name(falling back toDark/Light), and the accent from a Rust-debug-formatted struct that is parsed forred/green/blue/alpha— printed as#RRGGBBwhen opaque and#RRGGBBAAotherwise. -
openboxparses XML by hand. The<theme><name>node is located withstrstr(), so a<name>that appears after</theme>is rejected, and a missing node yieldsCouldn't find theme node in "…". The config file isopenbox/rc.xml, oropenbox/lxqt-rc.xml/openbox/lxde-rc.xmlunder LXQt / LXDE. -
Errors are invisible by default. Every failure string goes through
ffPrintError()and needsdisplay.showErrorsto betrue.
ffDetectWmTheme() takes a single FFstrbuf* that is either the theme or the error message —
hence the name themeOrError — and returns a bool. ffPrintWMTheme() prints the buffer on
success and passes the same buffer through ffPrintError() on failure; the JSON path writes it to
error or result accordingly.
ffDetectWmTheme() dispatches on the display server's pretty WM name. Four mechanisms are used:
-
Config files — kwin (
kwinrc,theme =, defaultBreeze), openbox (rc.xmlvariants), COSMIC (~/.config/cosmic/…). -
GSettings / DConf — mutter's user-theme extension, muffin (two keys), marco
(
org.mate.Marco.general::theme). -
XFConf — xfwm4 (
/general/theme). -
GTK theme as a fallback —
detectGTKThemeAsWMTheme()tries GTK4, then GTK3, then GTK2, and is the whole answer formutteron a non-GNOME desktop and forenlightenment.
Two CFPreferencesCopyAppValue() reads against kCFPreferencesAnyApplication — the same values the
system exposes through defaults:
-
AppleAccentColormaps to a name (-1Graphite,0–6Red / Orange / Yellow / Green / Blue / Purple / Pink, anything elseUnknown), and an unset key meansMulticolor, which is the default on macOS. -
AppleInterfaceStyleis appended in parentheses; when it is unset the result is(Light), since macOS only stores the key while dark mode is active.
The preferences are read through cfprefsd rather than the raw plist file, so the answer matches
what the system itself sees.
Three registry reads, each optional: Themes::CurrentTheme for the file name,
DWM::AccentColor (a BGR value that is byte-swapped to RGB) with DWM::ColorizationColor as the
fallback, and Themes\Personalize::SystemUsesLightTheme / AppsUseLightTheme. When nothing at all
was found the module reports Failed to find current theme.
A BApplication is created — required before the app_server can be queried — and
DecorInfoUtility::CurrentDecorator() supplies the name.
[ { "type": "WMTheme", "result": "Custom - Blue (System: Dark, Apps: Dark)" } ]