// thalamus_screen.rs — F5: attention routing / daemon status // // Shows poc-daemon status: presence detection, idle timer, // notification routing, activity level. use ratatui::{ layout::Rect, style::{Color, Style}, text::Line, widgets::{Block, Borders, Paragraph, Wrap}, Frame, }; use super::{App, SCREEN_LEGEND}; fn fetch_daemon_status() -> Vec { std::process::Command::new("poc-daemon") .arg("status") .output() .ok() .and_then(|o| { if o.status.success() { String::from_utf8(o.stdout).ok() } else { None } }) .map(|s| s.lines().map(String::from).collect()) .unwrap_or_else(|| vec!["daemon not running".to_string()]) } impl App { pub(crate) fn draw_thalamus(&self, frame: &mut Frame, size: Rect) { let status_lines = fetch_daemon_status(); let section = Style::default().fg(Color::Yellow); let mut lines: Vec = Vec::new(); lines.push(Line::styled("── Thalamus ──", section)); lines.push(Line::raw("")); for line in &status_lines { lines.push(Line::raw(format!(" {}", line))); } let block = Block::default() .title_top(Line::from(SCREEN_LEGEND).left_aligned()) .title_top(Line::from(" thalamus ").right_aligned()) .borders(Borders::ALL) .border_style(Style::default().fg(Color::Cyan)); let para = Paragraph::new(lines) .block(block) .wrap(Wrap { trim: false }) .scroll((self.debug_scroll, 0)); frame.render_widget(para, size); } }