feat: Apply Fenris identity and Drive health grouping (issue #79)\n\n- Add wolf glyph identity (Fenris by Bongbetic) with fallback for unsupported terminals\n- Remove duplicate maker credit from service strip (single placement in titlebox)\n- Move vendor wear under Drive health with full context\n- Preserve all existing behavior: continuity, pause block, quit rail, auth banner, controls\n\nCloses #79

This commit is contained in:
xavierk
2026-09-14 16:10:20 +05:30
parent 01240ec8f0
commit 30122c5e6d
3 changed files with 366 additions and 17 deletions
+34 -12
View File
@@ -120,6 +120,26 @@ def _habit_bar(a: float, i: float, o: float, u: float, width: int = 40) -> str:
return bar + "\n" + legend
# ---------------------------------------------------------------------------
# Identity and wolf glyph detection (issue #79)
# ---------------------------------------------------------------------------
# Wolf glyph for Fenris branding
_WOLF_GLYPH = "\U0001f43a" # 🐺
_IDENTITY_FULL = _WOLF_GLYPH + " Fenris by Bongbetic"
_IDENTITY_FALLBACK = "Fenris by Bongbetic"
def _can_render_wolf(width: int) -> bool:
"""Determine if the wolf glyph can be rendered without tofu.
Uses a conservative heuristic:
- Terminal width >= 80 columns (standard minimum)
- Wolf glyph width is 1 column in most terminals
"""
return width >= 80
# ---------------------------------------------------------------------------
# Bar graph glyphs and constants
# ---------------------------------------------------------------------------
@@ -893,7 +913,7 @@ class DisclosuresScreen(ModalScreen[None]):
class FenrisTuiApp(App):
"""Fenris Panes TUI — keyboard-first, one dense screen (spec §7)."""
TITLE = "Fenris — NVMe endurance monitor"
TITLE = _IDENTITY_FULL
SUB_TITLE = ""
CSS = """
@@ -982,7 +1002,13 @@ class FenrisTuiApp(App):
def _headline_prefix(self) -> str:
"""Render identity and any launch-only guidance above drive state."""
lines = ["[bold]Fenris — NVMe endurance monitor[/bold]"]
# Use wolf glyph if terminal can render it (issue #79)
width = getattr(self, '_size', (80, 24))[0] if hasattr(self, '_size') else 80
if _can_render_wolf(width):
identity = _IDENTITY_FULL
else:
identity = _IDENTITY_FALLBACK
lines = ["[bold]%s[/bold]" % identity]
if self._show_auth_notice:
lines.append("[dim]privileged actions will prompt for authentication (polkit)[/dim]")
return "\n".join(lines)
@@ -1029,8 +1055,7 @@ class FenrisTuiApp(App):
self.query_one("#usage-history").set_data([])
self.query_one("#drive-health").update("")
self.query_one("#service-strip").update(
"boot: disabled · timer: inactive · last collect: unknown · freshness: empty · "
"[dim]by Bongbetic[/dim]\n"
"boot: disabled · timer: inactive · last collect: unknown · freshness: empty\n"
"[bold]CONTINUITY[/bold] %s\n"
"p pause · r resume · c collect · d disclosures"
% monitoring_continuity({"boot_enabled": False})
@@ -1044,7 +1069,6 @@ class FenrisTuiApp(App):
self.query_one("#usage-history").set_data([])
self.query_one("#drive-health").update("")
self.query_one("#service-strip").update(
"[dim]by Bongbetic[/dim]\n"
"p pause · r resume · c collect · d disclosures"
)
@@ -1092,14 +1116,14 @@ class FenrisTuiApp(App):
else:
graph.set_data(day_data, on_drill=self._on_graph_drill)
# --- Drive-health pane (§7.2 right) ---
# --- Drive-health pane (§7.2 right, issue #79) ---
health = _query_drive_health(conn)
# Vendor wear grouped under Drive health with context
health_text = (
"[bold]Drive health[/bold] · %s\n"
" temperature %d°C · spare %d%%\n"
" media errors %d · unsafe shutdowns %d\n"
" power-on %d h · %d cycles · %s\n\n"
"[bold]Settings[/bold]\n"
" power-on %d h · %d cycles · %s\n"
" vendor wear: %d%% used · %.1f TB written"
) % (
health["model"],
@@ -1127,10 +1151,9 @@ class FenrisTuiApp(App):
)
# Render using the shared composition with TUI styling
status_text = render_status_tui(comp)
# Add TUI-only branding and actions
# Add TUI-only actions
self.query_one("#service-strip").update(
"%s\n"
"[dim]by Bongbetic[/dim]\n"
"p pause · r resume · c collect · d disclosures"
% status_text
)
@@ -1138,8 +1161,7 @@ class FenrisTuiApp(App):
except Exception:
self._hide_paused_banner()
self.query_one("#service-strip").update(
"boot: unknown · timer: unknown · last collect: unknown · freshness: unknown · "
"[dim]by Bongbetic[/dim]\n"
"boot: unknown · timer: unknown · last collect: unknown · freshness: unknown\n"
"p pause · r resume · c collect · d disclosures"
)