{ config, pkgs, lib, ... }:

let
  cfg = config.theming.dock;
in
{
  imports = [
    ../shared/hyprland.nix
  ];
  options.theming.dock = {
    enable = lib.mkOption {
      default = false;
      type = lib.types.bool;
    };
    autostart = lib.mkOption {
      default = false;
      type = lib.types.bool;
    };
  };

  config = {
    home.pointerCursor = {
      x11.enable = !config.shared.hyprland.enable;
      name = "Bibata-Modern-Classic";
      package = pkgs.bibata-cursors;
      gtk.enable = true;
      size = 20;
    };

    gtk = {
      enable = true;
      theme = {
        name = "Adwaita-dark";
        package = pkgs.gnome-themes-extra;
      };
      cursorTheme = {
        name = "Bibata-Modern-Classic";
        package = pkgs.bibata-cursors;
        size = 20;
      };
      iconTheme = {
        name = "Papirus-Dark";
        package = pkgs.papirus-icon-theme;
      };
      gtk3 = {
        extraConfig.gtk-application-prefer-dark-theme = true;
      };
      gtk4 = {
        extraConfig.gtk-application-prefer-dark-theme = true;
      };
    };

    qt = {
      enable = true;
      platformTheme.name = "qtct";
      style.package = pkgs.adwaita-qt;
      style.name = "adwaita-dark";
    };

    home.sessionVariables = {
      "GTK_THEME" = "Adwaita:dark";
    };

    home.packages = lib.mkIf cfg.enable [
      pkgs.plank pkgs.libwnck pkgs.bamf
    ];

    xdg.autostart = lib.mkIf cfg.autostart {
      enable = true;
      entries = [
        "${pkgs.plank}/share/applications/plank.desktop"
      ];
    };
  };
}
