"""Bottom status line for the TUI.
Hosts the activity indicator (left) and a dim key-combo summary (right). The
indicator is the live "agent is working" signal; the combos keep the line
useful while idle. Sits at the very bottom, replacing Textual's Footer so the
working indicator and the key hints share one line.
"""
from __future__ import annotations
from textual.app import ComposeResult
from textual.containers import Horizontal
from textual.widgets import Static
from clients.terminal.tui.widgets.activity_indicator import ActivityIndicator
_COMBOS = "Ctrl+P palette · Ctrl+X Q quit · Esc stop"
class StatusBar(Horizontal):
"""One-line bottom bar: activity indicator + key combos."""
DEFAULT_CSS = """
StatusBar {
height: 1;
background: $tui-panel;
color: $tui-text-dim;
padding: 0 1;
}
StatusBar ActivityIndicator {
width: auto;
height: 1;
}
StatusBar .combos {
color: $tui-text-dim;
text-align: right;
width: 1fr;
height: 1;
}
"""
def __init__(self) -> None:
super().__init__()
self._activity = ActivityIndicator()
self._combos = Static(_COMBOS, classes="combos")
def compose(self) -> ComposeResult:
yield self._activity
yield self._combos
def activity_start(self, label: str) -> None:
self._activity.start(label)
def activity_label(self, label: str) -> None:
self._activity.set_label(label)
def activity_stop(self) -> None:
self._activity.stop()