dotfiles.nix/home/kitty.nix

117 lines
3.2 KiB
Nix

{ pkgs, ... }:
# Let-In --------------------------------------------------------------------------------------- {{{
let
colorsToKitty = colors: with colors; {
inherit
background
foreground
selection_background
selection_foreground
tab_bar_background
active_tab_background
active_tab_foreground
inactive_tab_background
inactive_tab_foreground;
cursor = white;
cursor_text_color = background;
color0 = black;
color8 = black;
color1 = red;
color9 = red;
color2 = green;
color10 = lime;
color3 = yellow;
color11 = orange;
color4 = blue;
color12 = blue;
color5 = magenta;
color13 = magenta;
color6 = cyan;
color14 = cyan;
color7 = white;
color15 = white;
url_color = brightgreen;
};
font = "CaskaydiaCove Nerd Font";
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 = {
font_family = font;
font_size = "15.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_powerline_style = "angled";
tab_title_template = "{index}: {title}";
active_tab_font_style = "bold";
inactive_tab_font_style = "normal";
tab_activity_symbol = "💬";
# Shell integration manually enabled for fish
shell_integration = "disabled";
macos_option_as_alt = "both";
};
programs.kitty.extras.useSymbolsFromNerdFont = font;
# }}}
# Colors config ------------------------------------------------------------------------------ {{{
programs.kitty.extras.colors = {
enable = true;
dark = colorsToKitty pkgs.lib.colors.tokyonight.dark;
light = colorsToKitty pkgs.lib.colors.tokyonight.light;
color-pkg = pkgs.kitty-themes;
dark-name = "themes/rose-pine";
light-name = "themes/rose-pine-dawn";
};
programs.fish.functions.set-term-colors = {
body = ''
if test "$term_background" = light
term-light
else
term-dark
end
'';
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
'';
programs.fish.shellAliases = {
s = "kitty +kitten ssh";
e = "edit-in-kitty";
};
# }}}
# Fix icon config
programs.kitty.extras.fixIcon = {
enable = true;
appPath = "~/Applications/Home\\ Manager\\ Apps/kitty.app";
iconPath = "${pkgs.kitty-icon}/kitty-dark.icns";
};
}