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