fix: kitty status bar clock — redraw via add_timer, drop bogus tab_bar_timeout
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user