# Dark theme for GTK and Qt apps. # # There is no desktop environment on this machine to hand apps a theme, so # every toolkit has to be told separately: # # GTK2 ~/.gtkrc-2.0 + GTK2_RC_FILES -- adw-gtk3 has no GTK2 variant, so # old apps get Adwaita-dark from gnome-themes-extra instead. # GTK3 gtk-3.0/settings.ini (gtk-theme-name + prefer-dark). # GTK4 libadwaita apps ignore gtk-theme-name; they follow the # color-scheme=prefer-dark that the gtk3 module also writes into # dconf, which is why programs.dconf.enable is on system-side. # Electron/ Chromium, Brave, Firefox and friends ask the settings portal for # browsers color-scheme, and xdg-desktop-portal-gtk answers from that same # dconf key. # Qt5/Qt6 qt5ct/qt6ct, because nixpkgs builds qtbase without the qgtk3 # platform theme (withGtk3 = false), so QT_QPA_PLATFORMTHEME=gtk3 # would silently do nothing. # KDE apps KColorScheme reads colors from ~/.config/kdeglobals, not the Qt # palette, and falls back to light Breeze when it is missing -- # which is why KDE apps came out half dark, half white. A # .colors file is already in kdeglobals format. { pkgs, ... }: { gtk = { enable = true; colorScheme = "dark"; theme = { name = "adw-gtk3-dark"; package = pkgs.adw-gtk3; }; iconTheme = { name = "Adwaita"; package = pkgs.adwaita-icon-theme; }; gtk2.theme = { name = "Adwaita-dark"; package = pkgs.gnome-themes-extra; }; }; qt = { enable = true; platformTheme.name = "qtct"; # Pulls adwaita-qt{,6} in without setting QT_STYLE_OVERRIDE -- that # variable makes qt5ct/qt6ct skip their own config entirely. style.package = [ pkgs.adwaita-qt pkgs.adwaita-qt6 pkgs.kdePackages.breeze ]; qt5ctSettings.Appearance = { style = "Adwaita-Dark"; icon_theme = "Adwaita"; standard_dialogs = "xdgdesktopportal"; }; qt6ctSettings.Appearance = { style = "Breeze"; icon_theme = "Adwaita"; standard_dialogs = "xdgdesktopportal"; }; }; xdg.configFile."kdeglobals".source = "${pkgs.kdePackages.breeze}/share/color-schemes/BreezeDark.colors"; }