kitty terminal configuration

This commit is contained in:
Quentin Boyer 2022-04-10 10:57:49 +02:00
parent 54f54df829
commit 51cc0c7b42
2 changed files with 61 additions and 2 deletions

View file

@ -13,7 +13,7 @@ let
cCfg = cfg.colors;
in
{
imports = [ ./foot.nix ];
imports = [ ./foot.nix ./kitty.nix ];
options = {
terminal = {
@ -23,7 +23,7 @@ in
description = "Manage terminal";
};
kind = mkOption {
type = types.enum [ "foot" ];
type = types.enum [ "foot" "kitty" ];
default = "foot";
description = "The terminal to be used";
};

59
wm/terminal/kitty.nix Normal file
View file

@ -0,0 +1,59 @@
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let
cfg = config.terminal;
cCfg = cfg.colors;
in
{
config = mkIf (cfg.enable && cfg.kind == "kitty") {
programs.kitty = {
enable = true;
font = {
name = cfg.font.family;
size = cfg.font.size;
};
settings =
let
colorCfg = value: mkIf (value != null) "#${value}";
colorCfgNormal = color: colorCfg color.normal;
colorCfgBright = color: if color.bright != null then "#${color.bright}" else colorCfgNormal color;
in
{
background = colorCfg cCfg.background;
foreground = colorCfg cCfg.foreground;
color0 = colorCfgNormal cCfg.black;
color8 = colorCfgBright cCfg.black;
color1 = colorCfgNormal cCfg.red;
color9 = colorCfgBright cCfg.red;
color2 = colorCfgNormal cCfg.green;
color10 = colorCfgBright cCfg.green;
color3 = colorCfgNormal cCfg.yellow;
color11 = colorCfgBright cCfg.yellow;
color4 = colorCfgNormal cCfg.blue;
color12 = colorCfgBright cCfg.blue;
color5 = colorCfgNormal cCfg.magenta;
color13 = colorCfgBright cCfg.magenta;
color6 = colorCfgNormal cCfg.cyan;
color14 = colorCfgBright cCfg.cyan;
color7 = colorCfgNormal cCfg.white;
color15 = colorCfgBright cCfg.white;
selection_foreground = colorCfg cCfg.selectionForeground;
};
};
wayland.windowManager.sway.config.terminal = "${pkgs.kitty}/bin/kitty";
xsession.windowManager.i3.config.terminal = "${pkgs.kitty}/bin/kitty";
};
}