dotfiles.nix/home/kitty.nix

130 lines
3.9 KiB
Nix

{ config, lib, pkgs, ... }:
# Let-In --------------------------------------------------------------------------------------- {{{
let
inherit (lib) mkIf;
backgroundDependantColors = colors: with colors; {
background = "#${base}";
foreground = "#${main}";
# Cursor
cursor = "#${blue}";
cursor_text_color = "#${base}";
# Selection
selection_background = "#${muted}";
selection_foreground = "#${base}";
# Tab bar
tab_bar_background = "#${basehl}";
inactive_tab_background = "#${strong}";
};
commonColors = colors: with colors; {
# ref for tokyo-night colors
# https://github.com/davidmathers/tokyo-night-kitty-theme/blob/trunk/tokyo-night-kitty.conf
# black
color0 = "#${darkBasehl}";
color8 = "#${darkBase}";
# red
color1 = "#${red}";
color9 = "#${orange}";
# green
color2 = "#${green}";
color10 = "#${darkestTone}";
# yellow
color3 = "#${yellow}";
color11 = "#${darkTone}";
# blue
color4 = "#${blue}";
color12 = "#${lightTone}";
# magenta
color5 = "#${magenta}";
color13 = "#${violet}";
# cyan
color6 = "#${cyan}";
color14 = "#${lightestTone}";
# white
color7 = "#${lightBasehl}";
color15 = "#${lightBase}";
# url underline color to fit colors
url_color = "#${blue}";
# tab bar
active_tab_foreground = "#${lightBase}";
active_tab_background = "#${green}";
inactive_tab_foreground = "#${lightBase}";
};
in
# }}}
{
# Kitty terminal
# https://sw.kovidgoyal.net/kitty/conf.html
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.kitty.enable
programs.kitty.enable = true;
# General config ----------------------------------------------------------------------------- {{{
programs.kitty.settings = {
# # https://fsd.it/shop/fonts/pragmatapro/
# font_family = "PragmataPro Mono Liga";
font_family = "FiraCode Nerd Font";
font_size = "14.0";
adjust_line_height = "120%";
disable_ligatures = "cursor"; # disable ligatures when cursor is on them
# Window layout
hide_window_decorations = "titlebar-only";
window_padding_width = "10";
# Tab bar
tab_bar_edge = "top";
tab_bar_style = "powerline";
tab_title_template = "Tab {index}: {title}";
active_tab_font_style = "bold";
inactive_tab_font_style = "normal";
tab_activity_symbol = "";
# Shell integration manually enabled for fish
shell_integration = "disabled";
};
# Change the style of italic font variants
# programs.kitty.extraConfig = ''
# font_features PragmataProMonoLiga-Italic +ss06
# font_features PragmataProMonoLiga-BoldItalic +ss07
# '';
programs.kitty.extras.useSymbolsFromNerdFont = "FiraCode Nerd Font";
# }}}
# Colors config ------------------------------------------------------------------------------ {{{
programs.kitty.extras.colors =
let
theme = pkgs.lib.colors.tokyo-night; in
{
enable = true;
# Colors that aren't dependent on background
common =
# tokyo night doesn't really have a specific violet
commonColors (theme.colors // { violet = theme.colors.magenta; });
# Background dependent colors
dark = backgroundDependantColors theme.dark;
light = backgroundDependantColors theme.light;
};
programs.fish.functions.set-term-colors = {
body = "term-background $term_background";
onVariable = "term_background";
};
programs.fish.interactiveShellInit = ''
# Set term colors based on value of `$term_background` when shell starts up.
set-term-colors
# Manually enable shell integration
if set -q KITTY_INSTALLATION_DIR
set --global KITTY_SHELL_INTEGRATION enabled
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
end
'';
# }}}
}