{ config, pkgs, lib, ... }: let cfg = config.programs.kitty; inherit (lib) hm mkIf mkOption types; in { options.programs.kitty.fixIcon = { enable = mkOption { type = types.bool; default = false; description = '' When enabled, uses fileicon to fixup the icon. ''; }; appPath = mkOption { type = types.str; default = null; description = "Path to kitty.app"; }; iconPath = mkOption { type = types.str; default = null; description = "Path to kitty icns"; }; }; config = mkIf cfg.enable { home.activation = mkIf (pkgs.stdenv.isDarwin && cfg.fixIcon.enable) { cleanupKittyIcon = hm.dag.entryBetween [ "darwinApps" ] [ "writeBoundary" ] '' if ${pkgs.fileicon} test ${cfg.fixIcon.appPath}; then $DRY_RUN_CMD sudo ${pkgs.fileicon} rm ${cfg.fixIcon.appPath} fi ''; fixKittyIcon = hm.dag.entryAfter [ "darwinApps" ] '' $DRY_RUN_CMD sudo ${pkgs.fileicon} set ${cfg.fixIcon.appPath} ${cfg.fixIcon.iconPath} ''; }; }; }