tab bar cleanup
This commit is contained in:
parent
8ce4ddeef5
commit
d7f3415f67
1 changed files with 4 additions and 6 deletions
|
@ -1,16 +1,14 @@
|
||||||
# pyright: reportMissingImports=false
|
# pyright: reportMissingImports=false
|
||||||
# from pprint import pprint
|
|
||||||
# from kitty.window import CwdRequest
|
# from kitty.window import CwdRequest
|
||||||
|
import os
|
||||||
from kitty.boss import get_boss
|
from kitty.boss import get_boss
|
||||||
from kitty.fast_data_types import Screen, get_options
|
from kitty.fast_data_types import Screen, get_options
|
||||||
from kitty.utils import color_as_int
|
from kitty.utils import color_as_int
|
||||||
from kitty.tab_bar import (
|
from kitty.tab_bar import (
|
||||||
DrawData,
|
DrawData,
|
||||||
ExtraData,
|
ExtraData,
|
||||||
Formatter,
|
|
||||||
TabBarData,
|
TabBarData,
|
||||||
as_rgb,
|
as_rgb,
|
||||||
draw_attributed_string,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
opts = get_options()
|
opts = get_options()
|
||||||
|
@ -35,7 +33,6 @@ def draw_tab(
|
||||||
is_last: bool,
|
is_last: bool,
|
||||||
extra_data: ExtraData,
|
extra_data: ExtraData,
|
||||||
) -> int:
|
) -> int:
|
||||||
|
|
||||||
active_window = get_boss().active_window_for_cwd
|
active_window = get_boss().active_window_for_cwd
|
||||||
# active_dir = CwdRequest(active_window)
|
# active_dir = CwdRequest(active_window)
|
||||||
active_pid = active_window.child.pid
|
active_pid = active_window.child.pid
|
||||||
|
@ -44,18 +41,19 @@ def draw_tab(
|
||||||
with open(f"/tmp/current_venv-{active_pid}", "r") as f:
|
with open(f"/tmp/current_venv-{active_pid}", "r") as f:
|
||||||
env = f.read()
|
env = f.read()
|
||||||
if env != "":
|
if env != "":
|
||||||
env = f"{env}"
|
env = f"{env}".replace(os.environ.get("HOME", ""), "~")
|
||||||
else:
|
else:
|
||||||
return screen.cursor.x
|
return screen.cursor.x
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(f"KITTY TAB BAR ERROR: Can't find /tmp/current_venv for {active_pid}")
|
print(f"KITTY TAB BAR ERROR: Can't find /tmp/current_venv for {active_pid}")
|
||||||
return screen.cursor.x
|
return screen.cursor.x
|
||||||
|
|
||||||
screen.cursor.x = screen.columns - len(str(env)) - 4
|
screen.cursor.x = screen.columns - len(str(env)) - 5
|
||||||
|
|
||||||
draw(screen, bg, 0, "")
|
draw(screen, bg, 0, "")
|
||||||
draw(screen, 0, bg, " ")
|
draw(screen, 0, bg, " ")
|
||||||
draw(screen, icon_fg, bg, "")
|
draw(screen, icon_fg, bg, "")
|
||||||
draw(screen, text_fg, bg, " " + env)
|
draw(screen, text_fg, bg, " " + env)
|
||||||
|
draw(screen, 0, bg, " ")
|
||||||
|
|
||||||
return screen.cursor.x
|
return screen.cursor.x
|
||||||
|
|
Loading…
Add table
Reference in a new issue