{
  marleylib,
  config,
  osConfig,
  lib,
  pkgs,
  ...
}: let
  inherit (marleylib.module) mkEnableOption';

  cfg = config.marleyos.programs.pidgin;
  osCfg = osConfig.marleyos.programs.pidgin.enable or false;
in {
  options.marleyos.programs.pidgin.enable = mkEnableOption' "pidgin" osCfg;

  config = lib.mkIf cfg.enable {
    programs.pidgin = {
      enable = true;
      package = lib.mkIf pkgs.stdenv.isDarwin pkgs.emptyDirectory;

      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
      ''
        ${lib.getExe config.programs.pidgin.package} &
      '';

    wayland.windowManager.hyprland.settings.exec-once = [
      (lib.getExe config.programs.pidgin.package)
    ];
  };
}
