Kitty: Difference between revisions

From NixOS Wiki
Layer-09 (talk | contribs)
m Added link
Layer-09 (talk | contribs)
m Removed numbering
Line 5: Line 5:
== Installation ==
== Installation ==


==== 2.1 Using nix-shell ====
==== Using nix-shell ====
<syntaxhighlight lang="bash" start="3">
<syntaxhighlight lang="bash" start="3">
nix-shell -p kitty
nix-shell -p kitty
</syntaxhighlight>
</syntaxhighlight>


==== 2.2 System-Wide Installation on NixOS ====
==== System-Wide Installation on NixOS ====
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
environment.systemPackages = [
environment.systemPackages = [
Line 19: Line 19:
</syntaxhighlight>
</syntaxhighlight>


==== 2.3 User-Specific Installation with Home Manager ====
==== User-Specific Installation with Home Manager ====
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
home.packages = [  
home.packages = [  
Line 31: Line 31:
{{Note|Currently, configuring Kitty is possible only by using Home Manager.}}
{{Note|Currently, configuring Kitty is possible only by using Home Manager.}}


==== 3.1 Basic ====
==== Basic ====
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
programs.kitty = {
programs.kitty = {
Line 38: Line 38:
</syntaxhighlight>
</syntaxhighlight>


==== 3.2 Advanced ====
==== Advanced ====
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
programs.kitty = lib.mkForce {
programs.kitty = lib.mkForce {
Line 79: Line 79:
== Tips and Tricks ==
== Tips and Tricks ==


==== 4.1 Where to see a list of options? ====
==== Where to see a list of options? ====
The home manager options are defined in the following [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.kitty.enable Home Manager Options Manual].
The home manager options are defined in the following [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.kitty.enable Home Manager Options Manual].


==== 4.2 Can this be used with stylix? ====
==== Can this be used with stylix? ====
Yes, it can. See the following configuration:<syntaxhighlight lang="nix">
Yes, it can. See the following configuration:<syntaxhighlight lang="nix">
extraConfig = with config.stylix.base16Scheme; ''
extraConfig = with config.stylix.base16Scheme; ''
Line 133: Line 133:
</syntaxhighlight>
</syntaxhighlight>


==== 4.3 How to map kitty to a key? ====
==== How to map kitty to a key? ====
It depends on the window manager that you are using. On [https://wiki.nixos.org/wiki/Hyprland Hyprland] it's fairly easy:<syntaxhighlight lang="nix">
It depends on the window manager that you are using. On [https://wiki.nixos.org/wiki/Hyprland Hyprland] it's fairly easy:<syntaxhighlight lang="nix">
bind = [
bind = [

Revision as of 06:37, 24 June 2024

Kitty is a modern, fast, GPU-based terminal emulator that leverages modern graphics hardware for high performance. It works on macOS and Linux, supporting multiple tabs and windows for managing sessions. Kitty can be extended with scripts, supports Unicode and emojis, and offers extensive customization through its configuration file. It integrates well with the operating system, including features like clipboard support and drag-and-drop functionality. Known for its high performance and responsiveness, Kitty is actively maintained with regular updates.

Overall, it is a powerful and flexible terminal emulator for advanced users.

Installation

Using nix-shell

nix-shell -p kitty

System-Wide Installation on NixOS

environment.systemPackages = [
  pkgs.kitty
];

After modifying your configuration, apply the changes by running:

sudo nixos-rebuild switch

User-Specific Installation with Home Manager

home.packages = [ 
  pkgs.kitty 
];

After updating your configuration, apply the changes by running:

home-manager switch

Configuration

Note: Currently, configuring Kitty is possible only by using Home Manager.

Basic

programs.kitty = {
    enable = true;
};

Advanced

programs.kitty = lib.mkForce {
  enable = true;
  settings = {
    confirm_os_window_close = 0;
    dynamic_background_opacity = true;
    enable_audio_bell = false;
    mouse_hide_wait = "-1.0";
    window_padding_width = 10;
    background_opacity = "0.5";
    background_blur = 5;
    symbol_map = let
      mappings = [
        "U+23FB-U+23FE"
        "U+2B58"
        "U+E200-U+E2A9"
        "U+E0A0-U+E0A3"
        "U+E0B0-U+E0BF"
        "U+E0C0-U+E0C8"
        "U+E0CC-U+E0CF"
        "U+E0D0-U+E0D2"
        "U+E0D4"
        "U+E700-U+E7C5"
        "U+F000-U+F2E0"
        "U+2665"
        "U+26A1"
        "U+F400-U+F4A8"
        "U+F67C"
        "U+E000-U+E00A"
        "U+F300-U+F313"
        "U+E5FA-U+E62B"
      ];
    in
      (builtins.concatStringsSep "," mappings) + " Symbols Nerd Font";
  };
};

Tips and Tricks

Where to see a list of options?

The home manager options are defined in the following Home Manager Options Manual.

Can this be used with stylix?

Yes, it can. See the following configuration:

extraConfig = with config.stylix.base16Scheme; ''
  foreground #${base05}
  background #${base00}
  color0  #${base03}
  color1  #${base08}
  color2  #${base0B}
  color3  #${base09}
  color4  #${base0D}
  color5  #${base0E}
  color6  #${base0C}
  color7  #${base06}
  color8  #${base04}
  color9  #${base08}
  color10 #${base0B}
  color11 #${base0A}
  color12 #${base0C}
  color13 #${base0E}
  color14 #${base0C}
  color15 #${base07}
  color16 #${base00}
  color17 #${base0F}
  color18 #${base0B}
  color19 #${base09}
  color20 #${base0D}
  color21 #${base0E}
  color22 #${base0C}
  color23 #${base06}
  cursor  #${base07}
  cursor_text_color #${base00}
  selection_foreground #${base01}
  selection_background #${base0D}
  url_color #${base0C}
  active_border_color #${base04}
  inactive_border_color #${base00}
  bell_border_color #${base03}
  tab_bar_style fade
  tab_fade 1
  active_tab_foreground   #${base04}
  active_tab_background   #${base00}
  active_tab_font_style   bold
  inactive_tab_foreground #${base07}
  inactive_tab_background #${base08}
  inactive_tab_font_style bold
  tab_bar_background #${base00}
'';

Stylix can also do it automatically for you. You have to set:

stylix.targets.kitty.enable = true;

How to map kitty to a key?

It depends on the window manager that you are using. On Hyprland it's fairly easy:

bind = [
  "$mod, Q, exec, kitty"
];

Troubleshooting

References

  1. https://github.com/kovidgoyal/kitty
  2. https://sw.kovidgoyal.net/kitty/
  3. https://nix-community.github.io/home-manager/options.xhtml#opt-programs.kitty.enable
  4. https://stylix.danth.me/options/hm.html#stylixtargetskittyenable