{
  lib,
  config,
  pkgs,
  ...
}:
let
  inherit (lib) mkEnableOption mkIf getExe;

  cfg = config.marleyos.programs.pidgin;
in
{
  options.marleyos.programs.pidgin.enable = mkEnableOption "pidgin";

  config = mkIf cfg.enable {
    programs.pidgin = {
      enable = true;

      plugins = with pkgs.pidginPackages; [
        pidgin-window-merge
      ];
    };

    home.file = {
      ".purple/smileys/pandamotes".source = ./pandamotes;
      ".purple/smileys/pixelhead".source = ./pixelhead;
      ".purple/themes/hearty".source = ./hearty;
    };

    xsession.initExtra = # sh
      ''
        ${getExe pkgs.pidgin} &
      '';
  };
}
