diff --git a/dot_config/kitty/tab_bar.py b/dot_config/kitty/tab_bar.py index 20a069f..311717e 100644 --- a/dot_config/kitty/tab_bar.py +++ b/dot_config/kitty/tab_bar.py @@ -26,6 +26,7 @@ from typing import Any # (checked with `fc-list ":charset=:family=VictorMono Nerd Font Mono"`). FOLDER = '\uf07b' # nf-fa-folder — the fallback: "a shell somewhere" EDITOR = '\ue62b' # nf-custom-neovim +STACKED = '\U000f0328' # nf-md-layers — stack layout is hiding the tab's other panes ICONS: dict[str, str] = { # editors (label becomes the edited file, see EDITORS below) @@ -112,6 +113,10 @@ _repo: dict[str, str] = {} def draw_title(data: dict[str, Any]) -> str: + return _title(data) + _stacked(data) + + +def _title(data: dict[str, Any]) -> str: tab = data['tab'] program = _program(_cmdlines(data['tab_id']), tab.active_exe) index = data['index'] @@ -127,6 +132,15 @@ def draw_title(data: dict[str, Any]) -> str: return f'{index} {icon} {_elide(label or data["title"])}' +def _stacked(data: dict[str, Any]) -> str: + """` 3` when the stack layout (super+z) shows one of 3 panes, else ''. + + kitty marks the tab bar dirty on every layout change, so toggling repaints this. + """ + panes = data['num_window_groups'] + return f' {STACKED} {panes}' if data['layout_name'] == 'stack' and panes > 1 else '' + + def _cmdlines(tab_id: int) -> list[list[str]]: """argv of every foreground process of the tab's active window.