# Qt Flatpak Apps Don't Detect Dark Mode on GNOME **TL;DR**: Qt6 Flatpak apps using the KDE runtime ignore GNOME's dark mode preference. The workaround is three environment variables + Kvantum. ## The Problem If you run Qt/KDE Flatpak apps (qBittorrent, OBS Studio, VLC, etc.) on GNOME with dark mode enabled, they render with a light theme — white backgrounds, light widgets, the works. This is caused by two bugs in the Qt/KDE stack. ## Root Cause ### Bug 1: Qt's `gtk3` platform theme ignores `color-scheme` Since GNOME 42 (2022), dark mode is expressed via: ``` gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' ``` The GTK theme name stays **"Adwaita"** — it's no longer changed to "Adwaita-dark". GTK4/libadwaita apps read `color-scheme` natively and handle this fine. But Qt6's QGtk3Theme (`QT_QPA_PLATFORMTHEME=gtk3`) only reads `gtk-theme-name`. It sees "Adwaita", assumes light, and provides a light QPalette. It never checks `color-scheme`. **Affects**: All Qt6 apps on GNOME, not just Flatpak. **References**: - [Qt Forum: colorSchemeChanged under Gnome](https://forum.qt.io/topic/145065/colorschemechanged-under-gnome) — confirms root cause - Possibly tracked as [QTBUG-141102](https://bugreports.qt.io/browse/QTBUG-141102) ### Bug 2: KDE's `xdgdesktopportal` platform theme doesn't provide a dark palette The KDE Flatpak runtime includes an `xdgdesktopportal` platform theme (`libqxdgdesktopportal.so`). It correctly reads the XDG Settings portal: ```bash $ gdbus call --session \ --dest org.freedesktop.portal.Desktop \ --object-path /org/freedesktop/portal/desktop \ --method org.freedesktop.portal.Settings.Read \ "org.freedesktop.appearance" "color-scheme" # Returns: (<>,) ← 1 = prefer-dark ``` But it doesn't translate `color-scheme = 1` into a dark QPalette. Apps get a light palette regardless. **Affects**: All Qt6 Flatpak apps using the KDE runtime on any non-KDE desktop. **References**: - [KDE flatpak-platform-plugin](https://invent.kde.org/niccolove/flatpak-platform-plugin) - [KDE Bug 422064](https://bugs.kde.org/show_bug.cgi?id=422064) (closed as dup, underlying issue unresolved) - [EasyEffects #4475](https://github.com/wwmm/easyeffects/issues/4475) — same root cause ## Workaround Three environment variables + Kvantum theme engine. Tested on GNOME 49 / Wayland / Fedora 43 / KDE runtime 6.9. ### 1. Install Kvantum for your KDE runtime versions ```bash # Check which runtimes your apps use flatpak list --columns=application,runtime | grep org.kde # Install Kvantum for each branch (skip versions that don't exist) flatpak install -y flathub org.kde.KStyle.Kvantum//6.9 flatpak install -y flathub org.kde.KStyle.Kvantum//6.10 flatpak install -y flathub org.kde.KStyle.Kvantum//5.15-24.08 # Note: 6.8 build doesn't exist as of Feb 2026 ``` ### 2. Create the Kvantum config ```bash mkdir -p ~/.config/Kvantum printf '[General]\ntheme=KvGnomeDark\n' > ~/.config/Kvantum/kvantum.kvconfig ``` KvGnomeDark is a built-in Kvantum theme designed to mimic Adwaita dark on GNOME. ### 3. Set Flatpak overrides ```bash flatpak override --user \ --env=QT_STYLE_OVERRIDE=kvantum \ --env=QT_QPA_PLATFORMTHEME=gtk3 \ --env=GTK_THEME=Adwaita:dark \ --filesystem=xdg-config/Kvantum:ro ``` ### 4. Restart your apps That's it. Here's what each piece does: | Variable | Purpose | |---|---| | `GTK_THEME=Adwaita:dark` | Tells Qt's gtk3 platform theme that dark mode is active (works around Bug 1) | | `QT_QPA_PLATFORMTHEME=gtk3` | Qt reads GTK settings → provides dark QPalette for widget backgrounds | | `QT_STYLE_OVERRIDE=kvantum` | Kvantum renders widgets using KvGnomeDark (Adwaita-like dark appearance) | | `xdg-config/Kvantum:ro` | Exposes Kvantum config to the Flatpak sandbox | ### Limitations - **Not auto-switching**: Toggling GNOME light/dark won't update running apps. You'd need to change `GTK_THEME` and the Kvantum theme manually. - **No Kvantum for all runtimes**: Some KDE runtime versions (e.g. 6.8) don't have a Kvantum build. Apps on those runtimes will get the dark palette but default Breeze rendering. - **Approximate match**: KvGnomeDark looks like Adwaita but isn't pixel-perfect. For a closer match, try [KvLibadwaita](https://github.com/GabePoel/KvLibadwaita). ## What Doesn't Work (Saved You the Trouble) | Approach | Result | |---|---| | `QT_STYLE_OVERRIDE=adwaita-dark` | KDE's KColorScheme overrides the palette — widget chrome goes dark but content areas (tables, dialogs) stay white | | `QT_QPA_PLATFORMTHEME=xdgdesktopportal` | Portal reports dark but palette stays light (Bug 2) | | `QT_QPA_PLATFORMTHEME=gnome` (QGnomePlatform) | Unmaintained for Qt6, can't read dconf inside Flatpak sandbox | | `kdeglobals` with `ColorScheme=BreezeDark` | KDE platform theme ignores it inside Flatpak | | Kvantum with `respect_DE=false` | Platform theme still overrides the palette | | `QT_QPA_PLATFORMTHEME=gtk3` alone | Reads `gtk-theme-name=Adwaita`, assumes light (Bug 1) | ## Environment - **OS**: Fedora 43 (Bluefin) — but this affects any GNOME 42+ system - **Desktop**: GNOME 49.2 / Wayland - **Apps tested**: qBittorrent 5.1.4, OBS Studio, VLC, Fedora Media Writer - **KDE runtimes**: 5.15-24.08, 6.8, 6.9, 6.10