From b339b3e73832a3481982fdb33ed87cdc4a21e768 Mon Sep 17 00:00:00 2001 From: Mortdecai Date: Tue, 29 Sep 2026 16:22:25 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20kitty=20status=20bar=20clock=20=E2=80=94?= =?UTF-8?q?=20redraw=20via=20add=5Ftimer,=20drop=20bogus=20tab=5Fbar=5Ftim?= =?UTF-8?q?eout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kitty has no tab_bar_timeout option (ignored with a warning), so the clock/CPU/mem only refreshed on tab changes. tab_bar.py now registers a repeating 10s timer that marks every tab bar dirty. Verified in Xvfb: idle window's clock ticked 16:21 -> 16:22. Co-Authored-By: Claude Opus 5.5 (1M context) --- Kitty-setup.md | 4 ++-- kitty/kitty-theme.conf | 3 +-- kitty/tab_bar.py | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Kitty-setup.md b/Kitty-setup.md index 385ef6d..648b7ec 100644 --- a/Kitty-setup.md +++ b/Kitty-setup.md @@ -114,12 +114,12 @@ All read from `/proc` (no subprocess overhead except git): - **Colors**: Edit `_ORANGE`, `_DIM`, `_TAB_BG`, `_BAR_BG` in `tab_bar.py` - **Status items**: Add/remove cells in the `if is_last:` block in `tab_bar.py` -- **Refresh rate**: Change `tab_bar_timeout` in `kitty-theme.conf` (seconds) +- **Refresh rate**: Change `REFRESH_SECS` in `tab_bar.py` (seconds) - **User prefix**: The `_prefix` logic in `tab_bar.py` shows `user@` for non-seth users ## Troubleshooting - **Icons show as boxes**: Nerd Font not installed or kitty not using it. Check `font_family` in kitty.conf. -- **Status bar not updating**: Ensure `tab_bar_timeout 60.0` is set in kitty-theme.conf. +- **Status bar not updating**: `REFRESH_SECS` timer in `tab_bar.py` drives redraws (kitty has no `tab_bar_timeout` option); check `kitty` stderr for tab_bar.py errors. - **F12 does nothing**: Ensure `allow_remote_control yes` and `listen_on unix:/tmp/kitty-{kitty_pid}` are in config. Restart kitty (not just reload). - **CPU shows "..."**: Normal on first draw — needs two samples to compute delta. diff --git a/kitty/kitty-theme.conf b/kitty/kitty-theme.conf index f1a3cb0..ff9a6bf 100644 --- a/kitty/kitty-theme.conf +++ b/kitty/kitty-theme.conf @@ -29,8 +29,7 @@ inactive_tab_font_style normal tab_bar_background #0d0d0d tab_bar_margin_height 2.0 0.0 -# Refresh tab bar for clock updates -tab_bar_timeout 60.0 +# Clock/stats refresh: timer in tab_bar.py (REFRESH_SECS) — kitty has no tab_bar_timeout option # Toggle tab/status bar map f12 remote_control load-config --override tab_bar_min_tabs=999 diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index cbff639..dd885d1 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -9,6 +9,7 @@ import os import subprocess from datetime import datetime +from kitty.fast_data_types import add_timer, get_boss from kitty.tab_bar import ( DrawData, ExtraData, @@ -36,6 +37,16 @@ _DIM = as_rgb(0x666666) _TAB_BG = as_rgb(0x1A1A1A) _BAR_BG = as_rgb(0x0D0D0D) +# kitty only redraws the tab bar on tab changes; this timer keeps the clock/stats live. +# ponytail: 10s = clock lags <=10s; each redraw runs git on kitty's main thread, so don't go much lower. +REFRESH_SECS = 10.0 +_timer_id = None + + +def _refresh(_timer_id) -> None: + for tm in get_boss().all_tab_managers: + tm.mark_tab_bar_dirty() + def _get_git_branch() -> str: try: @@ -106,6 +117,10 @@ def draw_tab( is_last: bool, extra_data: ExtraData, ) -> int: + global _timer_id + if _timer_id is None: + _timer_id = add_timer(_refresh, REFRESH_SECS, True) + # Build tab title title = tab.title if _prefix: