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";
];
```
This commit is contained in:
Brenton Simpson 2026-01-19 00:36:20 -05:00 committed by Austin Horstman
parent 0fba737f8d
commit 1a7b0c4315
2 changed files with 45 additions and 4 deletions

View file

@ -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.
'';
}

View file

@ -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;