Add kitty icon fixer

work
mat ess 2022-05-07 21:50:31 -04:00
parent 10bccf6fcd
commit 59033a6d67
3 changed files with 55 additions and 3 deletions

View File

@ -76,18 +76,34 @@
"locked": { "locked": {
"lastModified": 1651948785, "lastModified": 1651948785,
"narHash": "sha256-3UoMx0cLnFJt4/2HpMGrlOqWUFJfuLMgKqi1ytL8GxM=", "narHash": "sha256-3UoMx0cLnFJt4/2HpMGrlOqWUFJfuLMgKqi1ytL8GxM=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ac4d124eeed195db518712120fbf2b384a254ca2", "rev": "ac4d124eeed195db518712120fbf2b384a254ca2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixpkgs-21.11-darwin", "ref": "nixpkgs-21.11-darwin",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs-master": {
"locked": {
"lastModified": 1651974066,
"narHash": "sha256-cwqBq1jwqVHvg034IZsK5dgpnbwmgReaONJ1zeAZg6w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "06f6e05c4e25ac4b626645b03cd2922f093275ee",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1651927509, "lastModified": 1651927509,
@ -111,6 +127,7 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"
} }
} }

View File

@ -72,4 +72,11 @@ in
end end
''; '';
# }}} # }}}
# Fix icon config
programs.kitty.extras.fixIcon = {
enable = true;
appPath = "~/Applications/Home\ Manager\ Apps/kitty.app";
iconPath = "~/Development/kitty-icon/kitty-dark.icns";
};
} }

View File

@ -45,7 +45,7 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
When enable, commands <command>term-dark</command> and <command>term-light</command> will When enabled, commands <command>term-dark</command> and <command>term-light</command> will
toggle between your dark and a light colors. toggle between your dark and a light colors.
<command>term-background</command> which accepts one argument (the value of which should <command>term-background</command> which accepts one argument (the value of which should
be <literal>dark</literal> or <literal>light</literal>) is also avaible. be <literal>dark</literal> or <literal>light</literal>) is also avaible.
@ -100,6 +100,28 @@ in
''; '';
}; };
fixIcon = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
When enabled, uses fileicon (should be installed via homebrew) 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 config.programs.kitty.enable { config = mkIf config.programs.kitty.enable {
@ -110,6 +132,12 @@ in
term-background term-background
]; ];
home.activation = mkIf (pkgs.stdenv.isDarwin && cfg.fixIcon.enable) {
fixKittyIcon = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
sudo /opt/homebrew/bin/fileicon set ${cfg.fixIcon.appPath} ${cfg.fixIcon.iconPath}
'';
};
programs.kitty.settings = optionalAttrs cfg.colors.enable programs.kitty.settings = optionalAttrs cfg.colors.enable
( (