]> git.r.bdr.sh - rbdr/dotfiles/commitdiff
Make kitty tabs pilly
authorRuben Beltran del Rio <redacted>
Wed, 18 Dec 2024 08:03:48 +0000 (09:03 +0100)
committerRuben Beltran del Rio <redacted>
Wed, 18 Dec 2024 08:03:48 +0000 (09:03 +0100)
config/kitty/kitty.conf
config/kitty/tab_bar.py [new file with mode: 0644]

index 5bc1968791c1f0de0768d3f2659ca01cee6f62fb..b696cdbf8310c801d24fe7243ce3cab16f31a7f5 100644 (file)
@@ -135,9 +135,9 @@ color15 #ffffff
 # window
 hide_window_decorations titlebar-only
 window_margin_width 10 5 5
 # window
 hide_window_decorations titlebar-only
 window_margin_width 10 5 5
-tab_bar_style separator
-tab_separator " ⁣ "
+tab_bar_style custom
 tab_bar_margin_width 5.0
 tab_bar_margin_width 5.0
+tab_bar_margin_height 5.0 0.0
 
 enabled_layouts splits,tall,fat,grid,stack
 
 
 enabled_layouts splits,tall,fat,grid,stack
 
diff --git a/config/kitty/tab_bar.py b/config/kitty/tab_bar.py
new file mode 100644 (file)
index 0000000..c88e483
--- /dev/null
@@ -0,0 +1,31 @@
+from kitty.fast_data_types import Screen
+from kitty.tab_bar import DrawData, ExtraData, TabBarData, draw_title
+
+def draw_tab(
+    draw_data: DrawData, screen: Screen, tab: TabBarData,
+    before: int, max_tab_length: int, index: int, is_last: bool,
+    extra_data: ExtraData
+) -> int:
+    transparent = 0
+    orig_bg = screen.cursor.bg
+    orig_fg = screen.cursor.fg
+    screen.cursor.bg = 0
+    screen.cursor.fg = orig_bg
+    screen.draw('◖')
+    screen.cursor.bg = orig_bg
+    screen.cursor.fg = orig_fg
+    draw_title(draw_data, screen, tab, index, max_tab_length)
+    trailing_spaces = min(max_tab_length - 1, draw_data.trailing_spaces)
+    max_tab_length -= trailing_spaces
+    extra = screen.cursor.x - before - max_tab_length
+    if extra > 0:
+        screen.cursor.x -= extra + 1
+        screen.draw('…')
+    screen.cursor.bg = 0
+    screen.cursor.fg = orig_bg
+    screen.draw('◗ ')
+    end = screen.cursor.x
+    screen.cursor.bold = screen.cursor.italic = False
+    screen.cursor.fg = 0
+    screen.cursor.bg = 0
+    return end