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;