Added Kitty terminal configuration

This commit is contained in:
Fabio Scotto di Santolo
2024-07-21 10:14:01 +02:00
parent b49f8e3dff
commit b17918923d
4 changed files with 239 additions and 1 deletions

View File

@@ -9,10 +9,11 @@ Below is a list of the software:
- Fastfetch - Fastfetch
- Fish - Fish
- Git - Git
- Kitty
- Neovim - Neovim
- Profile - Profile
- Ranger - Ranger
- Starship - Starship
- Tmux - Tmux
- Zellij - Zellij
- Zsh - Zsh

View File

@@ -0,0 +1,59 @@
import tempfile
import os
from shutil import which
from typing import List
from kitty.boss import Boss
ENABLED_LAYOUTS = [
'fat',
'grid',
'horizontal',
'splits',
'stack',
'tall',
'vertical',
]
def fzf(choices: List[str], delimiter='\n'):
exe = which("fzf")
if not exe:
raise SystemError(f"Cannot find 'fzf' installed on $PATH.")
shell = which("zsh") or os.environ.get("SHELL")
if not shell:
raise SystemError(f"Cannot find a $SHELL to use.")
selection = []
with tempfile.NamedTemporaryFile(delete=True) as input_file:
with tempfile.NamedTemporaryFile(delete=True) as output_file:
input_file.write(delimiter.join(map(str, choices)).encode('utf-8'))
input_file.flush()
os.system(f"{shell} -c '{exe} --reverse < \"{input_file.name}\" > \"{output_file.name}\"'")
for line in output_file:
selection.append(line.strip().decode("utf-8"))
return selection
def main(args: List[str]) -> str:
fzf_path = os.path.join(os.environ["HOME"], ".fzf/bin")
os.environ["PATH"] += f":{fzf_path}"
result = fzf(ENABLED_LAYOUTS)
if len(result) > 0:
return result[0]
return ""
def handle_result(args: List[str], answer: str, target_window_id: int, boss: Boss) -> None:
try:
window = boss.window_id_map.get(target_window_id)
tab = boss.tab_for_window(window)
tab.goto_layout(answer)
except Exception:
pass

View File

@@ -0,0 +1,98 @@
# vim:ft=kitty foldmethod=marker
kitty_mod ctrl+shift
scrollback_lines -1
# UI {{{1
# Theme
include theme.conf
# Window layout
remember_window_size no
initial_window_width 160c
initial_window_height 45c
# Tab bar
tab_bar_min_tabs 1
tab_bar_edge top
tab_bar_style hidden
tab_powerline_style slanted
tab_title_template {title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}
# Fonts
font_size 12.0
font_family Roboto Nerd Font
bold_font Roboto Nerd Font Bold
italic_font Roboto Nerd Font Italic
bold_italic_font Roboto Nerd Font Bold Italic
disable_ligatures never
# Cursor
cursor_shape block
cursor_blink_interval 1
shell_integration no-cursor no-title
# Color scheme
background_opacity 0.90
background_blur 1
background_image none
# Advanced
shell tmux
# OS specific tweaks
linux_display_server wayland
wayland_titlebar_color system
wayland_enable_ime yes
# vim-kitty-navigator {{{1
allow_remote_control yes
listen_on unix:/tmp/mykitty
# Keyboard shortcuts
copy_on_select yes
macos_option_as_alt yes
# Zoom on a window just like in tmux
map kitty_mod+a toggle_layout stack
# Open tabs and windows in the same folder
map kitty_mod+enter new_window_with_cwd
map cmd+enter new_window_with_cwd
map kitty_mod+t new_tab_with_cwd
map cmd+t new_tab_with_cwd
# Move a window into a new tab
map kitty_mod+x detach_window new-tab
# tmux {{{1
# Jump to tabs
map ctrl+a>1 goto_tab 4
map ctrl+a>2 goto_tab 2
map ctrl+a>3 goto_tab 3
map ctrl+a>4 goto_tab 4
map ctrl+a>5 goto_tab 5
map ctrl+a>6 goto_tab 6
map ctrl+a>7 goto_tab 7
map ctrl+a>8 goto_tab 8
map ctrl+a>9 goto_tab 9
map ctrl+a>0 goto_tab 0
# Move a window into a new tab
map ctrl+a>! detach_window new-tab
# Open a new window
map ctrl+a>o new_window_with_cwd
# Open a new tab
map ctrl+a>c new_tab_with_cwd
# Zoom on a window
map ctrl+a>z toggle_layout stack
# Change layout
map ctrl+a>space next_layout
# Choose layout
map ctrl+a>l kitten choose_layout.py
# }}}

View File

@@ -0,0 +1,80 @@
# vim:ft=kitty
## name: Gnome-ish gray-on-black
## author: Ittner (https://www.ittner.com.br)
## license: GPLv3+
## blurb: A theme based on the colors of the classic Gnome Terminal
#: The basic colors
background #000000
foreground #aaaaaa
selection_background #b4d5ff
selection_foreground #000000
#: Cursor colors
cursor #aaaaaa
cursor_text_color #111111
#: URL underline color when hovering with mouse
url_color #0087bd
#: kitty window border colors and terminal bell colors
active_border_color #00ff00
inactive_border_color #cccccc
bell_border_color #ff5a00
visual_bell_color none
#: OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
#: Tab bar colors
active_tab_foreground #000
active_tab_background #eee
inactive_tab_foreground #444
inactive_tab_background #999
tab_bar_background none
tab_bar_margin_color none
#: Colors for marks (marked text in the terminal)
mark1_foreground black
mark1_background #98d3cb
mark2_foreground black
mark2_background #f2dcd3
mark3_foreground black
mark3_background #f274bc
#: The basic 16 colors
color0 #1e1e1e
color8 #5d5d5d
color1 #c01c28
color9 #f66151
color2 #26a269
color10 #33d17a
color3 #a2734c
color11 #e9ad0c
color4 #12488b
color12 #2a7bde
color5 #a347ba
color13 #c061cb
color6 #2aa1b3
color14 #33c7de
color7 #cfcfcf
color15 #ffffff
#: You can set the remaining 240 colors as color16 to color255.