From d7f3415f67bee3536890c92dbbd5a8a139412d77 Mon Sep 17 00:00:00 2001
From: Luca Bilke <bilke@tralios.de>
Date: Tue, 4 Apr 2023 13:18:17 +0200
Subject: [PATCH] tab bar cleanup

---
 .config/kitty/tab_bar.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/.config/kitty/tab_bar.py b/.config/kitty/tab_bar.py
index bc372fb9..fc63ddcf 100755
--- a/.config/kitty/tab_bar.py
+++ b/.config/kitty/tab_bar.py
@@ -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