diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-12-18 09:03:48 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-12-18 09:03:48 +0100 |
| commit | 76e13011a3527bab0eb3b88920973a00e3527223 (patch) | |
| tree | 0bfcd86c885fe6d829dd13702803d403bd48dd42 /config/kitty/tab_bar.py | |
| parent | 2a122cd917c3c3a043304981d3a0cf93439b918f (diff) | |
Make kitty tabs pilly
Diffstat (limited to 'config/kitty/tab_bar.py')
| -rw-r--r-- | config/kitty/tab_bar.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/config/kitty/tab_bar.py b/config/kitty/tab_bar.py new file mode 100644 index 0000000..c88e483 --- /dev/null +++ b/config/kitty/tab_bar.py @@ -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 |