From ade4bc05e36fe71c766deb4649a1a88520b33a6f Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 19 Sep 2026 01:49:07 +0530 Subject: chore(terminal/kitty): split the kitty config into different modules --- modules/terminal/kitty/colors.nix | 39 ++++++++++++++++++++++++++++++++++ modules/terminal/kitty/default.nix | 36 ++++++------------------------- modules/terminal/kitty/keybindings.nix | 10 +++++++++ modules/terminal/kitty/kitty.conf | 14 ------------ 4 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 modules/terminal/kitty/colors.nix create mode 100644 modules/terminal/kitty/keybindings.nix diff --git a/modules/terminal/kitty/colors.nix b/modules/terminal/kitty/colors.nix new file mode 100644 index 0000000..a91b0b2 --- /dev/null +++ b/modules/terminal/kitty/colors.nix @@ -0,0 +1,39 @@ +# Colorscheme for kitty +{ + config, + lib, + pkgs, + ... +}: +{ + config.programs.kitty.settings = lib.mkIf config.terminal.kitty.enable ( + let + base16Colors = import ../../colors/base16 { inherit config lib pkgs; }; + in + with base16Colors.colorsWithHashPrefix; + { + background = base00; + foreground = base05; + + color0 = base00; + color1 = base08; + color2 = base0B; + color3 = base0A; + color4 = base0D; + color5 = base0E; + color6 = base0C; + color7 = base05; + color8 = base03; + color9 = base09; + color10 = base0B; + color11 = base0A; + color12 = base0D; + color13 = base0E; + color14 = base0F; + color15 = base07; + + selection_background = base05; + selection_foreground = base00; + } + ); +} diff --git a/modules/terminal/kitty/default.nix b/modules/terminal/kitty/default.nix index f72f862..38f74ac 100644 --- a/modules/terminal/kitty/default.nix +++ b/modules/terminal/kitty/default.nix @@ -2,13 +2,14 @@ { config, lib, - pkgs, ... }: -let - base16Colors = import ../../colors/base16 { inherit config lib pkgs; }; -in { + imports = [ + ./colors.nix + ./keybindings.nix + ]; + options.terminal.kitty = { enable = lib.mkEnableOption "Enables kitty."; package = lib.mkOption { @@ -27,40 +28,15 @@ in programs.kitty = { enable = true; extraConfig = builtins.readFile ./kitty.conf; - settings = with base16Colors.colorsWithHashPrefix; { + settings = { window_padding_width = 10; font_size = config.fonts.size; font_family = config.fonts.normal; filter_notification = "all"; update_check_interval = 0; scrollbar_indicator_opacity = "0.5"; - dynamic_background_opacity = false; enable_audio_bell = false; - - background = base00; - foreground = base05; - - color0 = base00; - color1 = base08; - color2 = base0B; - color3 = base0A; - color4 = base0D; - color5 = base0E; - color6 = base0C; - color7 = base05; - color8 = base03; - color9 = base09; - color10 = base0B; - color11 = base0A; - color12 = base0D; - color13 = base0E; - color14 = base0F; - color15 = base07; - - selection_background = base05; - selection_foreground = base00; - allow_remote_control = "yes"; listen_on = "unix:/tmp/kitty"; shell = lib.mkIf config.terminal.zsh.enable (lib.getExe config.terminal.zsh.package); diff --git a/modules/terminal/kitty/keybindings.nix b/modules/terminal/kitty/keybindings.nix new file mode 100644 index 0000000..728595d --- /dev/null +++ b/modules/terminal/kitty/keybindings.nix @@ -0,0 +1,10 @@ +# Keybindings for kitty +{ config, lib, ... }: +{ + config.programs.kitty.keybindings = lib.mkIf config.terminal.kitty.enable { + "ctrl+shift+k" = "scroll_line_up"; + "ctrl+shift+j" = "scroll_line_down"; + "ctrl+shift+u" = "scroll_page_up"; + "ctrl+shift+d" = "scroll_page_down"; + }; +} diff --git a/modules/terminal/kitty/kitty.conf b/modules/terminal/kitty/kitty.conf index c55fbce..d95efff 100644 --- a/modules/terminal/kitty/kitty.conf +++ b/modules/terminal/kitty/kitty.conf @@ -1,17 +1,3 @@ # Keep normal clicks for selection and prompt placement; Ctrl+click opens links. mouse_map left click ungrabbed mouse_handle_click selection prompt mouse_map ctrl+left click grabbed,ungrabbed mouse_handle_click link - -# Vim-style navigation between Kitty windows in the current tab. -map ctrl+shift+h neighboring_window left -map ctrl+shift+j neighboring_window bottom -map ctrl+shift+k neighboring_window top -map ctrl+shift+l neighboring_window right - -# Line scrolling -map ctrl+shift+j scroll_line_down -map ctrl+shift+k scroll_line_up - -# Page scrolling (half-page / full-page) -map ctrl+shift+u scroll_page_up -map ctrl+shift+d scroll_page_down -- cgit v1.2.3