From 0ec5b8032c980155638cf53d94044472009666ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Mon, 5 Oct 2026 20:01:51 +0800 Subject: [PATCH] fix(desktop): align Qt app fonts with GTK (#386) * fix(desktop): align Qt app fonts with GTK Qt apps kept their built-in default font ("Sans Serif" 9) while GTK apps use `gtk-font-name` (Noto Sans 11), so Telegram and other Qt apps rendered noticeably smaller than GTK apps like Firefox. Set QT_QPA_PLATFORMTHEME=gtk3; the plugin ships with qtbase, so it needs no extra package and also gives Qt apps GTK file dialogs. * chore(desktop): drop unused Xft.dpi from the Wayland GTK profile Xft.dpi/ *.dpi are X11 X-resource settings. This file is only imported by the niri (Wayland) hosts, where xwayland-satellite sets its own Xft.dpi (96 x output scale, currently 144), and the i3 hosts are headless 1080p computer-use sessions that do not import it. So the setting had no effect anywhere; remove it instead of keeping a misleading knob. --- home/linux/gui/base/desktop-tools.nix | 6 ++++++ home/linux/gui/base/gtk.nix | 8 -------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/home/linux/gui/base/desktop-tools.nix b/home/linux/gui/base/desktop-tools.nix index 1a4e6f99..14192b02 100644 --- a/home/linux/gui/base/desktop-tools.nix +++ b/home/linux/gui/base/desktop-tools.nix @@ -7,6 +7,12 @@ "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"; # misc "_JAVA_AWT_WM_NONREPARENTING" = "1"; "QT_WAYLAND_DISABLE_WINDOWDECORATION" = "1"; diff --git a/home/linux/gui/base/gtk.nix b/home/linux/gui/base/gtk.nix index a8415759..074b0d26 100644 --- a/home/linux/gui/base/gtk.nix +++ b/home/linux/gui/base/gtk.nix @@ -17,14 +17,6 @@ size = 24; }; - # set dpi for 4k monitor - xresources.properties = { - # dpi for Xorg's font - "Xft.dpi" = 150; - # or set a generic dpi - "*.dpi" = 150; - }; - # gtk's theme settings, generate files: # 1. ~/.gtkrc-2.0 # 2. ~/.config/gtk-3.0/settings.ini