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

let cfg = config.sydnix.users.crumb.discord;
in {
  options.sydnix.users.crumb.discord = {
    enable = lib.mkEnableOption "Discord";
  };

  config = lib.mkIf cfg.enable {
    sydnix.discord.enable = true;

    stylix.targets.nixcord.enable = true;

    programs.nixcord = {
      quickCss = ''
        /* Hide guild tags. */
        span > .clanTagChiplet_c19a55
        , .clanTag__972a0
        , .chipletContainerInner__10651
        { display: none !important
        }
      '';
      config = {
        useQuickCss = true;
        themeLinks = [
          # Compact++ (Default) — Themes Discord to look more like a typical IRC
          # client.
          "https://grzesiek11.stary.pc.pl/files/builds/compactpp/latest/compactpp-ultraclean.theme.css"
        ];
        plugins = {
          ircColors.enable = true;
        };
      };
      vesktop = {
        state.firstLaunch = false;
        settings = {
          minimizeToTray = false;
          arRPC = true;
        };
      };
    };
  };
}
