kayla: seed chrome's GTK theme via initial_preferences next to the binary

This commit is contained in:
rope 2026-08-10 10:18:10 +01:00
parent 9f4650b798
commit 744a2c2ed4

View file

@ -3,6 +3,27 @@
# FredOS-Gaming/FredOS-Macbook and stay off here). Windows refugees get a
# taskbar, a start menu and a settings app that look like what they left.
{ config, pkgs, lib, ... }:
let
# Under KDE, Chrome's GetDefaultSystemTheme() (ui/linux/linux_ui_factory.cc)
# hardcodes SystemTheme::kQt for every KDE* desktop — it reads only the
# detected desktop environment. No policy and no command-line switch changes
# that default (--ui-toolkit picks which backend gets built, not the pref),
# so the profile pref is the only lever.
#
# Chrome seeds a new profile from `initial_preferences`, which it looks for
# in DIR_EXE — the directory holding the binary (first_run_internal_linux.cc)
# — so it has to be baked into the package, not dropped in /etc. Everything
# outside the "distribution" key is copied into the profile on first run.
#
# system_theme: 0 = Classic, 1 = GTK, 2 = Qt (ui/color/system_theme.h).
chromeGtkDefault = pkgs.google-chrome.overrideAttrs (old: {
postInstall = (old.postInstall or "") + ''
cp ${pkgs.writeText "chrome-initial-preferences" (builtins.toJSON {
extensions.theme.system_theme = 1;
})} $out/share/google/chrome/initial_preferences
'';
});
in
{
config = lib.mkIf (config.networking.hostName == "FredOS-Kayla") {
services.displayManager.sddm = {
@ -59,12 +80,7 @@
stylix.targets.chromium.enable = false;
environment.systemPackages = with pkgs; [
# Chrome picks its toolkit from the desktop environment, and under KDE
# that's the Qt backend (hence the libqt{5,6}_shim.so it ships) — which
# is what's drawing the odd decorations. --ui-toolkit overrides that
# detection, so it uses GTK, i.e. the adw-gtk3 theme stylix already
# writes. No manual trip through Settings → Appearance.
(google-chrome.override { commandLineArgs = "--ui-toolkit=gtk"; })
chromeGtkDefault
spotify
vesktop
faugus-launcher