From 59033a6d6701cc0a66748c70a47bf04bf89bd5a8 Mon Sep 17 00:00:00 2001 From: mat ess Date: Sat, 7 May 2022 21:50:31 -0400 Subject: [PATCH] Add kitty icon fixer --- flake.lock | 21 ++++++++++++++++-- home/kitty.nix | 7 ++++++ modules/home/programs/kitty/extras.nix | 30 +++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 4cdad74..43b0777 100644 --- a/flake.lock +++ b/flake.lock @@ -76,18 +76,34 @@ "locked": { "lastModified": 1651948785, "narHash": "sha256-3UoMx0cLnFJt4/2HpMGrlOqWUFJfuLMgKqi1ytL8GxM=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "ac4d124eeed195db518712120fbf2b384a254ca2", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixpkgs-21.11-darwin", "repo": "nixpkgs", "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": { "locked": { "lastModified": 1651927509, @@ -111,6 +127,7 @@ "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", + "nixpkgs-master": "nixpkgs-master", "nixpkgs-unstable": "nixpkgs-unstable" } } diff --git a/home/kitty.nix b/home/kitty.nix index f7c12db..136f32a 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -72,4 +72,11 @@ in end ''; # }}} + + # Fix icon config + programs.kitty.extras.fixIcon = { + enable = true; + appPath = "~/Applications/Home\ Manager\ Apps/kitty.app"; + iconPath = "~/Development/kitty-icon/kitty-dark.icns"; + }; } diff --git a/modules/home/programs/kitty/extras.nix b/modules/home/programs/kitty/extras.nix index 95491df..c87fdea 100644 --- a/modules/home/programs/kitty/extras.nix +++ b/modules/home/programs/kitty/extras.nix @@ -45,7 +45,7 @@ in type = types.bool; default = false; description = '' - When enable, commands term-dark and term-light will + When enabled, commands term-dark and term-light will toggle between your dark and a light colors. term-background which accepts one argument (the value of which should be dark or light) 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 { @@ -110,6 +132,12 @@ in 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 (