Unverified Commit dd8978e6 authored by Brenton Simpson's avatar Brenton Simpson Committed by Michael Daniels
Browse files

google-chrome: add plasmaSupport option

Chrome has an optional feature to introspect your QT theme and generate
a Chrome theme from it.  It does this by [dynamically linking QT
(if present)](https://docs.google.com/document/d/1IO6NTtnJiEVps0WlUC_lDr1bBKO72zPNTe-4msoBYXk/edit?resourcekey=0-UbCM69FptaNMGX7JXGt-3Q).

A previous PR #375279 added basic support for this (by including `qt6`
as a derivation dependency), but it was broken.  The title bar was
always cyan regardless of what theme you had chosen in KDE.

This PR adds `plasma-integration` to correctly deduce the user's chosen
theme.  It also moves the current `qt6` dependency behind the new
`plasmaSupport` flag, ensuring that users who are not utilizing the QT
theme aren't pulling in QT inadvertently.

Only `google-chrome` is in scope for this PR (because it's what I use),
but others are welcome to copy it to fulfill #228751 for Chromium
derivatives.
parent e310f565
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -94,8 +94,10 @@
  addDriverRunpath,
  undmg,

  # For QT support
  # Enables Chrome's "Use QT" appearance to introspect the user's Plasma theme
  plasmaSupport ? false,
  qt6,
  kdePackages,

  # Create a symlink at $out/bin/google-chrome
  withSymlink ? true,
@@ -167,8 +169,12 @@ let
  ++ [
    gtk3
    gtk4
  ]
  ++ lib.optionals plasmaSupport [
    qt6.qtbase
    qt6.qtwayland
    kdePackages.plasma-integration
    kdePackages.breeze
  ];

  linux = stdenvNoCC.mkDerivation (finalAttrs: {
@@ -249,9 +255,13 @@ let

      # "--simulate-outdated-no-au" disables auto updates and browser outdated popup
      makeWrapper "$out/share/google/$appname/google-$appname" "$exe" \
        ${lib.optionalString plasmaSupport ''
          --prefix QT_PLUGIN_PATH  : "${qt6.qtbase}/lib/qt-6/plugins" \
          --prefix QT_PLUGIN_PATH  : "${qt6.qtwayland}/lib/qt-6/plugins" \
          --prefix QT_PLUGIN_PATH  : "${kdePackages.plasma-integration}/lib/qt-6/plugins" \
          --prefix QT_PLUGIN_PATH  : "${kdePackages.breeze}/lib/qt-6/plugins" \
          --prefix NIXPKGS_QT6_QML_IMPORT_PATH : "${qt6.qtwayland}/lib/qt-6/qml" \
        ''} \
        --prefix LD_LIBRARY_PATH : "$rpath" \
        --prefix PATH            : "$binpath" \
        --suffix PATH            : "${lib.makeBinPath [ xdg-utils ]}" \