From 9cc5d924510127df761b8f8e855f5ce97537e1ee Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 5 Oct 2026 23:14:28 +0800 Subject: [PATCH] fix(desktop): restore dynamic light/dark for Qt apps QT_QPA_PLATFORMTHEME=gtk3 (from #386) made Qt derive its color scheme from GTK3, which has no dynamic dark/light signal, so Telegram and other Qt apps were stuck on the light palette after Noctalia's theme mode changed. Use the portal theme instead: Qt then follows org.gnome.desktop.interface color-scheme, which Noctalia writes. The trade-off is Qt's built-in "Sans Serif" 9pt font, which a font-providing platform theme would be needed to change. --- home/linux/gui/base/desktop-tools.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/home/linux/gui/base/desktop-tools.nix b/home/linux/gui/base/desktop-tools.nix index 14192b02..d83afc5c 100644 --- a/home/linux/gui/base/desktop-tools.nix +++ b/home/linux/gui/base/desktop-tools.nix @@ -7,12 +7,14 @@ "MOZ_WEBRENDER" = "1"; # enable native Wayland support for most Electron apps "ELECTRON_OZONE_PLATFORM_HINT" = "auto"; - # Make Qt apps follow the GTK font and theme. Without this, Qt keeps its - # built-in default ("Sans Serif" 9) while GTK uses `gtk-font-name` - # (Noto Sans 11), so Qt apps like Telegram render visibly smaller than - # GTK apps. The `gtk3` platform theme plugin ships with qtbase, so no - # extra package is needed, and it also gets GTK file dialogs. - "QT_QPA_PLATFORMTHEME" = "gtk3"; + # Make Qt apps follow the system light/dark live. Noctalia's theme mode + # writes org.gnome.desktop.interface color-scheme, and this platform theme + # (shipped by qtbase) reads it over the XDG desktop portal. + # Do not switch to `gtk3`: it would align Qt's font with `gtk-font-name` + # (Noto Sans 11), but GTK3 has no dynamic dark/light signal, so Qt apps like + # Telegram would be stuck on the light palette. Qt's default font stays + # "Sans Serif" 9; only a font-providing theme can change that size. + "QT_QPA_PLATFORMTHEME" = "xdgdesktopportal"; # misc "_JAVA_AWT_WM_NONREPARENTING" = "1"; "QT_WAYLAND_DISABLE_WINDOWDECORATION" = "1";