feat(macos): add kitty

This commit is contained in:
Tomas Mirchev 2025-11-03 05:31:44 +01:00
parent 34b6439521
commit 866a25a66d
5 changed files with 169 additions and 0 deletions

View File

@ -0,0 +1,54 @@
# ~/.config/kitty/choose_tab.py
from kitty.boss import get_boss
from kittens.tui.handler import Handler
from kittens.tui.loop import Loop
class TabPicker(Handler):
def __init__(self):
super().__init__()
boss = get_boss()
win = boss.active_window
self.osw = win.os_window if win else None
self.tabs = list(self.osw.tabs) if self.osw else []
self.index = 0
def draw(self, screen):
screen.clear()
if not self.tabs:
screen.write_line("No tabs. Esc to exit.")
else:
screen.write_line("Choose a tab (↑/↓ Enter Esc)")
for i, t in enumerate(self.tabs):
mark = "" if t is self.osw.active_tab else " "
sel = ">" if i == self.index else " "
title = t.title or f"Tab {i+1}"
screen.write_line(f"{sel} {mark} {title}")
screen.refresh()
def on_key(self, event):
if not self.tabs:
if event.key in ("escape", "enter"):
self.quit_loop()
return
k = event.key
if k in ("up", "k"):
self.index = (self.index - 1) % len(self.tabs)
elif k in ("down", "j"):
self.index = (self.index + 1) % len(self.tabs)
elif k == "enter":
self.osw.set_active_tab(self.tabs[self.index])
self.quit_loop()
elif k == "escape":
self.quit_loop()
self.refresh()
def main(args):
# Correct signature for older Kitty: pass the class name and a title string
Loop(TabPicker, "choose_tab").run()
def handle_result(args, answer, target_window_id, boss):
pass

View File

@ -0,0 +1,35 @@
# vim:ft=kitty
background #eeeeee
foreground #444444
cursor #005fff
cursor_text_color #eeeeee
selection_background #dadada
selection_foreground #444444
url_color #005fff
# Tabs
active_tab_background #005fff
active_tab_foreground #eeeeee
inactive_tab_background #dadada
inactive_tab_foreground #9e9e9e
# normal
color0 #444444
color1 #ff0000
color2 #00af5f
color3 #d75f00
color4 #005fff
color5 #5f5f87
color6 #afd7ff
color7 #eeeeee
# bright
color8 #444444
color9 #ff0000
color10 #00af5f
color11 #d75f00
color12 #005fff
color13 #5f5f87
color14 #afd7ff
color15 #eeeeee

Binary file not shown.

View File

@ -0,0 +1,73 @@
include invero.conf
# term xterm-256color
enable_audio_bell no
cursor_shape block
wheel_scroll_multiplier 1.0
touch_scroll_multiplier 1.0
wheel_scroll_min_lines 1
shell_integration no-cursor
cursor_blink_interval 0
remember_window_position yes
remember_window_size yes
# Font
font_family Maple Mono
font_size 13.0
# disable_ligatures always
# undercurl_style thick-sparse
modify_font cell_width 94%
modify_font cell_height -2px
# modify_font baseline 2px
# modify_font underline_thickness 180%
# modify_font underline_position 2px
# modify_font strikethrough_positon 2px
text_composition_strategy legacy
# underline_exclusion 0
placement_strategy top
window_margin_width 0 0
window_padding_width 0 4
# modify_font cell_height -1
# modify_font cell_width 90%
# Navigation / editing
# Make Option act as Alt on macOS
macos_option_as_alt yes
# Use explicit bytes (no ambiguity), not \x1bb etc.
map opt+left send_text all \x1b\x62
map opt+right send_text all \x1b\x66
map cmd+left send_text all \x01
map cmd+right send_text all \x05
map opt+backspace send_text all \x1b\x7f
map cmd+backspace send_text all \x15
map opt+delete send_text all \x1b\x64
map cmd+delete send_text all \x0b
# New window / tab
map cmd+n new_os_window
map cmd+t new_tab
map cmd+1 goto_tab 1
map cmd+2 goto_tab 2
map cmd+3 goto_tab 3
map cmd+4 goto_tab 4
map cmd+5 goto_tab 5
map cmd+6 goto_tab 6
map cmd+7 goto_tab 7
map cmd+8 goto_tab 8
map cmd+9 goto_tab 9
# BEGIN_KITTY_FONTS
# font_family family="JetBrains Mono"
bold_font auto
italic_font auto
bold_italic_font auto
# END_KITTY_FONTS

View File

@ -105,6 +105,13 @@
"from": "macos/ghostty",
"to": "~/.config/ghostty"
}
},
{
"package": "kitty",
"link": {
"from": "macos/kitty",
"to": "~/.config/kitty"
}
}
],
"linux-vm": [