diff --git a/home/common.nix b/home/common.nix index 60004f4..2f41e69 100644 --- a/home/common.nix +++ b/home/common.nix @@ -6,6 +6,7 @@ ./fish/fish.nix ./modules/programs/my-broot.nix ./modules/programs/my-sway + ./modules/programs/my-kitty ./common-linux.nix ]; @@ -74,6 +75,8 @@ "~/.local/bin" ]; + nki.programs.kitty.enable = true; + # Programs programs = { bat = { diff --git a/home/fish/fish.nix b/home/fish/fish.nix index 50b50a2..2c0b914 100644 --- a/home/fish/fish.nix +++ b/home/fish/fish.nix @@ -53,7 +53,16 @@ end # Source iTerm2 integration - test -e ~/.iterm2_shell_integration.fish && source ~/.iterm2_shell_integration.fish + if test -e ~/.iterm2_shell_integration.fish; and test $__CFBundleIdentifier = "com.googlecode.iterm2" + source ~/.iterm2_shell_integration.fish + end + + # Source Kitty 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 # Enable vi keybindings fish_vi_key_bindings diff --git a/home/images/chise-bg.png b/home/images/chise-bg.png new file mode 100644 index 0000000..c16a5dd Binary files /dev/null and b/home/images/chise-bg.png differ diff --git a/home/kakoune/kakrc b/home/kakoune/kakrc index 0f8b24c..0a8ed8d 100644 --- a/home/kakoune/kakrc +++ b/home/kakoune/kakrc @@ -44,11 +44,11 @@ set global grepcmd "rg --line-number --no-column --no-heading --color=never ''" # } # } # } -map global user t -docstring "Open a side terminal on the current directory" ' :iterm-terminal-horizontal fish' +# map global user t -docstring "Open a side terminal on the current directory" ' :iterm-terminal-horizontal fish' # fzf.kak require-module fzf -set global fzf_terminal_command 'iterm-terminal-horizontal kak -c %val{session} -e "%arg{@}"' +# set global fzf_terminal_command 'iterm-terminal-horizontal kak -c %val{session} -e "%arg{@}"' # set global fzf_grep_command 'rg' set global fzf_highlight_command 'bat --style=plain --theme=GitHub --color=always {}' map global user f -docstring "FZF mode" ': fzf-mode' diff --git a/home/macbook-home.nix b/home/macbook-home.nix index a8eeaaf..c327fba 100644 --- a/home/macbook-home.nix +++ b/home/macbook-home.nix @@ -20,6 +20,7 @@ programs.fish.shellAliases = { brew64 = "arch -x86_64 /usr/local/bin/brew"; }; + nki.programs.kitty.background = ./images/chise-bg.png; home.sessionPath = [ # Personal .bin diff --git a/home/modules/programs/my-kitty/darwin.nix b/home/modules/programs/my-kitty/darwin.nix new file mode 100644 index 0000000..e155fb8 --- /dev/null +++ b/home/modules/programs/my-kitty/darwin.nix @@ -0,0 +1,63 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.nki.programs.kitty; + cmd = "cmd"; +in +with lib; { + programs.kitty = mkIf (cfg.enable && pkgs.stdenv.isDarwin) { + + # Darwin-specific setup + darwinLaunchOptions = [ + "--single-instance" + "--start-as=fullscreen" + ]; + + # Tabs and layouts keybindings + keybindings = { + # Backslash + "0x5d" = "send_text all \\u005c"; + + "${cmd}+shift+o" = "launch --location=vsplit"; + "${cmd}+o" = "launch --location=hsplit"; + "${cmd}+shift+r" = "layout_action rotate"; + ## Move the active window in the indicated direction + "${cmd}+shift+h" = "move_window left"; + "${cmd}+shift+j" = "move_window up"; + "${cmd}+shift+k" = "move_window down"; + "${cmd}+shift+l" = "move_window right"; + ## Switch focus to the neighboring window in the indicated direction + "${cmd}+h" = "neighboring_window left"; + "${cmd}+j" = "neighboring_window up"; + "${cmd}+k" = "neighboring_window down "; + "${cmd}+l" = "neighboring_window right"; + } + # Tab bindings + // builtins.listToAttrs + (map + (x: attrsets.nameValuePair "${cmd}+${toString x}" "goto_tab ${toString x}") + (lists.range 1 9)); + + extraConfig = mkAfter '' + # Tab settings + tab_bar_edge top + tab_bar_style powerline + tab_powerline_style slanted + tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.lightgreen}{fmt.bold}[{index}]{fmt.nobold} {fmt.fg.tab}{title}" + active_tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}" + tab_bar_background #555 + active_tab_font_style normal + + # Layouts + ## Mouse focus + focus_follows_mouse yes + ## Layout options + # Layouts + enabled_layouts Splits + inactive_text_alpha 0.65 + + # MacOS specific + macos_option_as_alt = left + ''; + }; +} + diff --git a/home/modules/programs/my-kitty/default.nix b/home/modules/programs/my-kitty/default.nix new file mode 100644 index 0000000..fe05f4c --- /dev/null +++ b/home/modules/programs/my-kitty/default.nix @@ -0,0 +1,85 @@ +{ pkgs, config, lib, ... }: + +let + cfg = config.nki.programs.kitty; + + # iosevka = pkgs.iosevka.override { + # privateBuildPlan = '' + # [buildPlans.iosevka-kagami] + # family = "Iosevka Kagami" + # spacing = "normal" + # serifs = "sans" + # no-cv-ss = true + + # [buildPlans.iosevka-kagami.variants] + # inherits = "ss06" + + # [buildPlans.iosevka-kagami.variants.design] + # k = "cursive-serifless" + + # [buildPlans.iosevka-kagami.ligations] + # inherits = "haskell" + # ''; + # set = "kagami"; + # }; + + cmd = if pkgs.stdenv.isDarwin then "cmd" else "ctrl"; +in +with lib; +{ + imports = [ ./darwin.nix ]; + + options.nki.programs.kitty = { + enable = mkEnableOption "Enable kitty"; + + # font + fontSize = mkOption { + type = types.int; + description = "Font size"; + default = 21; + }; + + background = mkOption + { + type = types.nullOr types.path; + description = "Path to the background image. If not set, default to a 0.9 opacity"; + default = null; + }; + }; + + config.programs.kitty = mkIf cfg.enable { + enable = true; + + font.package = pkgs.fantasque-sans-mono; + font.name = "Fantasque Sans Mono"; + font.size = cfg.fontSize; + + theme = "Ayu Light"; + + extraConfig = + let + background = + if isNull cfg.background then '' + background_opacity 1 + dynamic_background_opacity yes + '' else '' + background_image ${cfg.background} + background_image_layout scaled + background_tint 0.85 + ''; + in + '' + # Background color and transparency + ${background} + + # Scrollback (128MBs) + scrollback_pager_history_size 128 + + # Disable Shell integration (leave it for Nix) + shell_integration no-rc + ''; + + keybindings = { }; + }; +} +