{ ... }: {
  flake.homeManagerModules.wisdomDesktopGtkQtTheming =
    { config, lib, pkgs, ... }:
    let
      root = config.chiasson.home;
      cfg = config.chiasson.home.desktop.theming;
    in
    {
      options.chiasson.home.desktop.theming = {
        enable = lib.mkEnableOption ''
          WhiteSur GTK + icon themes, Phinger cursor, and Qt via the KDE platform theme — same idea as
          the old `home-shared.nix` stack for Hyprland/Niri (no full Plasma session required). Optional
          `dank-colors.css` import for DMS/matugen GTK accents.
        '';

        matugenGtkColors = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = ''
            Add `@import url("dank-colors.css");` to gtk3/gtk4 extraCss. DMS/matugen writes
            `~/.config/gtk-3.0` / `gtk-4.0` `dank-colors.css` when dynamic theming is on — disable if
            you use this module without DMS.
          '';
        };

        gtkTheme = {
          name = lib.mkOption {
            type = lib.types.str;
            default = "WhiteSur-Dark";
          };
          package = lib.mkOption {
            type = lib.types.package;
            default = pkgs.whitesur-gtk-theme;
          };
        };

        iconTheme = {
          name = lib.mkOption {
            type = lib.types.str;
            default = "WhiteSur-dark";
          };
          package = lib.mkOption {
            type = lib.types.package;
            default = pkgs.whitesur-icon-theme;
          };
        };

        cursor = {
          name = lib.mkOption {
            type = lib.types.str;
            default = "phinger-cursors-dark";
          };
          package = lib.mkOption {
            type = lib.types.package;
            default = pkgs.phinger-cursors;
          };
          size = lib.mkOption {
            type = lib.types.int;
            default = 32;
          };
        };

        qt = {
          platformTheme = lib.mkOption {
            type = lib.types.str;
            default = "kde";
            description = ''
              `QT_QPA_PLATFORMTHEME` (e.g. `kde` for Qt/KDE integration, matches previous flake).
            '';
          };
          extraPackages = lib.mkOption {
            type = lib.types.listOf lib.types.package;
            default = [ pkgs.whitesur-kde pkgs.qt6Packages.qt6ct ];
            description = "Extra packages (KDE look-and-feel + qt6ct GUI).";
          };
        };
      };

      config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
        {
          home.packages = cfg.qt.extraPackages;

          home.sessionVariables = {
            QT_QPA_PLATFORMTHEME = cfg.qt.platformTheme;
          };

          home.pointerCursor = {
            name = cfg.cursor.name;
            package = cfg.cursor.package;
            size = cfg.cursor.size;
            gtk.enable = true;
            x11.enable = true;
          };

          gtk = {
            enable = true;
            theme = {
              name = cfg.gtkTheme.name;
              package = cfg.gtkTheme.package;
            };
            iconTheme = {
              name = cfg.iconTheme.name;
              package = cfg.iconTheme.package;
            };
            cursorTheme = {
              name = cfg.cursor.name;
              package = cfg.cursor.package;
              size = cfg.cursor.size;
            };
            gtk3.extraConfig = {
              gtk-application-prefer-dark-theme = 1;
            };
            gtk4.extraConfig = {
              gtk-application-prefer-dark-theme = 1;
            };
          };
        }
        (lib.mkIf cfg.matugenGtkColors {
          gtk.gtk3.extraCss = ''
            @import url("dank-colors.css");
          '';
          gtk.gtk4.extraCss = ''
            @import url("dank-colors.css");
          '';
        })
      ]);
    };
}
