{ config, pkgs, lib, rice, user, ... }:
let
  # theme-name = "Colloid-Pink-Dark-Compact";
  # theme-package = pkgs.colloid-gtk-theme.override {
  #   themeVariants = [ "pink" ];
  #   colorVariants = [ "dark" ];
  #   sizeVariants = [ "compact" ]; 
  #   tweaks = [ "black" ]; 
  # };
  theme-name = "catppuccin-macchiato-pink-compact+rimless,black";
  theme-package = pkgs.catppuccin-gtk.override {
    accents = [ "pink" ];
    size = "compact";
    tweaks = [ "rimless" "black" ];
    variant = "macchiato";
  };
in
lib.mkIf (user != "tv")
{
  home.packages = with pkgs; [
    # gnome.gnome-themes-extra
    # gnome.adwaita-icon-theme
    gnome.gnome-tweaks
    gtk3
    gtk4
    # catppuccin-gtk
    bibata-cursors
  ] ++ [
    # pkgs-unstable.themix-gui
  ];


  home.sessionVariables.GTK_THEME = theme-name;

  gtk = {
    enable = true;
    theme = {
      name = theme-name;
      package = theme-package;
        };
      gtk3.extraConfig = {
        gtk-application-prefer-dark-theme = 1;
      };
      gtk4.extraConfig = {
        gtk-application-prefer-dark-theme = 1;
      };
      cursorTheme = rice.cursor;
    };

    home.pointerCursor = {
      gtk.enable = true;
      x11.enable = true;
    } // rice.cursor;

    xdg.configFile = {
      "gtk-4.0/assets".source = "${theme-package}/share/themes/${theme-name}/gtk-4.0/assets";
      "gtk-4.0/gtk.css".source = "${theme-package}/share/themes/${theme-name}/gtk-4.0/gtk.css";
      "gtk-4.0/gtk-dark.css".source = "${theme-package}/share/themes/${theme-name}/gtk-4.0/gtk-dark.css";
    };




    dconf = {
      enable = true;
      settings = {
        "org/gnome/desktop/interface" = {
          color-scheme = "prefer-dark";
          gtk-theme = theme-name;
        };
      };
    };
  }
