mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
feat(config): add stacked layout icon to kitty tab bar)
This commit is contained in:
1 parent
16614bd532
commit
6c47c816a9
1 file changed
+14
@@ -26,6 +26,7 @@ from typing import Any
|
||||
# (checked with `fc-list ":charset=<hex>: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:
|
||||
"""` <layers icon> 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.
|
||||
|
||||
|
||||
Reference in new issue
Block a user