Skip to content

how to implement tab drawing in python? #4366

Answered by page-down
zzhaolei asked this question in Q&A
Discussion options

You must be logged in to vote

https://github.com/kovidgoyal/kitty/blob/master/kitty/tab_bar.py

See draw_tab_with_*, e.g. draw_tab_with_separator().

~/.config/kitty/tab_bar.py

from kitty.fast_data_types import Screen
# from kitty.rgb import Color
# from kitty.utils import color_as_int

from kitty.tab_bar import DrawData, ExtraData, TabBarData
# from kitty.tab_bar import as_rgb, draw_title


def draw_tab(
    draw_data: DrawData, screen: Screen, tab: TabBarData,
    before: int, max_title_length: int, index: int, is_last: bool,
    extra_data: ExtraData
) -> int:
    # Draw your own tab with `screen.draw()`, `screen.apply_sgr()`.
    # You can use the function `draw_title(draw_data, screen, tab, index)`.
    # Move the …

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
7 replies
@zzhaolei
Comment options

@page-down
Comment options

@zzhaolei
Comment options

@page-down
Comment options

@zzhaolei
Comment options

Answer selected by zzhaolei
Comment options

You must be logged in to vote
2 replies
@page-down
Comment options

@horseinthesky
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants