From 1a7b0c4315c800d44d6953c2393d5c5127a99ad4 Mon Sep 17 00:00:00 2001 From: Brenton Simpson Date: Mon, 19 Jan 2026 00:36:20 -0500 Subject: [PATCH] chromium: add plasmaSupport option for google-chrome This flag allows Chrome to dynamically link to QT in order to introspect your Plasma theme and make Chrome match. Note, you may still need to add this entry to your home-manager config: ``` home.sessionVariables = [ QT_QPA_PLATFORMTHEME = "kde"; ]; ``` --- .../misc/news/2026/01/2026-01-19_05-36-20.nix | 19 ++++++++++++ modules/programs/chromium.nix | 30 ++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 modules/misc/news/2026/01/2026-01-19_05-36-20.nix diff --git a/modules/misc/news/2026/01/2026-01-19_05-36-20.nix b/modules/misc/news/2026/01/2026-01-19_05-36-20.nix new file mode 100644 index 00000000..212827ef --- /dev/null +++ b/modules/misc/news/2026/01/2026-01-19_05-36-20.nix @@ -0,0 +1,19 @@ +{ + time = "2026-01-19T05:36:20+00:00"; + condition = true; + message = '' + Chrome now has a `plasmaSupport` flag. + + If you use KDE Plasma, set: + + ``` + programs.google-chrome.plasmaSupport = true` + home.sessionVariables = [ + QT_QPA_PLATFORMTHEME = "kde"; + ]; + ``` + + This enables the "Use QT" theme in **Settings > Appearance**, which makes + Chrome match your Plasma theme. + ''; +} diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index ba6974de..038b0888 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -16,6 +16,10 @@ let vivaldi = "Vivaldi Browser"; }; + plasmaSupportedBrowsers = [ + "google-chrome" + ]; + browserModule = browser: name: visible: let @@ -66,6 +70,15 @@ let ''; }; } + // lib.optionalAttrs (lib.elem browser plasmaSupportedBrowsers) { + plasmaSupport = mkOption { + inherit visible; + type = types.bool; + default = false; + example = true; + description = "Whether to enable the 'Use QT' theme for ${name}."; + }; + } // lib.optionalAttrs (!isProprietaryChrome) { # Extensions do not work with Google Chrome # see https://github.com/nix-community/home-manager/issues/1383 @@ -152,6 +165,7 @@ let List of ${name} dictionaries to install. ''; }; + nativeMessagingHosts = mkOption { type = types.listOf types.package; default = [ ]; @@ -230,10 +244,18 @@ let ]; programs.${browser}.finalPackage = - if cfg.commandLineArgs != [ ] then - cfg.package.override { - commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; - } + if cfg.package == null then + null + else if cfg.commandLineArgs != [ ] || (cfg.plasmaSupport or false) then + cfg.package.override ( + lib.optionalAttrs (cfg.commandLineArgs != [ ]) { + commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; + } + // lib.optionalAttrs (cfg.plasmaSupport or false) { + plasmaSupport = true; + kdePackages = pkgs.kdePackages; + } + ) else cfg.package;