mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-05 04:08:03 +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"`).
|
# (checked with `fc-list ":charset=<hex>:family=VictorMono Nerd Font Mono"`).
|
||||||
FOLDER = '\uf07b' # nf-fa-folder — the fallback: "a shell somewhere"
|
FOLDER = '\uf07b' # nf-fa-folder — the fallback: "a shell somewhere"
|
||||||
EDITOR = '\ue62b' # nf-custom-neovim
|
EDITOR = '\ue62b' # nf-custom-neovim
|
||||||
|
STACKED = '\U000f0328' # nf-md-layers — stack layout is hiding the tab's other panes
|
||||||
|
|
||||||
ICONS: dict[str, str] = {
|
ICONS: dict[str, str] = {
|
||||||
# editors (label becomes the edited file, see EDITORS below)
|
# 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:
|
def draw_title(data: dict[str, Any]) -> str:
|
||||||
|
return _title(data) + _stacked(data)
|
||||||
|
|
||||||
|
|
||||||
|
def _title(data: dict[str, Any]) -> str:
|
||||||
tab = data['tab']
|
tab = data['tab']
|
||||||
program = _program(_cmdlines(data['tab_id']), tab.active_exe)
|
program = _program(_cmdlines(data['tab_id']), tab.active_exe)
|
||||||
index = data['index']
|
index = data['index']
|
||||||
@@ -127,6 +132,15 @@ def draw_title(data: dict[str, Any]) -> str:
|
|||||||
return f'{index} {icon} {_elide(label or data["title"])}'
|
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]]:
|
def _cmdlines(tab_id: int) -> list[list[str]]:
|
||||||
"""argv of every foreground process of the tab's active window.
|
"""argv of every foreground process of the tab's active window.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user