aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYoungTaek <soomtong@gmail.com>2026-05-09 23:21:03 +0900
committerGitHub <noreply@github.com>2026-05-09 17:21:03 +0300
commit78904186dd9c9150326b2996ebebc4e8914d68d5 (patch)
tree93bc01394326b97ef934094d34743c94839aa408 /src
parentdb2360f8f80d46e98e88b8649e0f2cd8a8cdbd57 (diff)
Show focus on active agent in agents panel like spaces panel does (#84)
* feat: show focus on active agent in agents panel like spaces panel does * refactor: improve to calculation and binding style
Diffstat (limited to 'src')
-rw-r--r--src/app/state.rs23
-rw-r--r--src/ui/sidebar.rs25
2 files changed, 44 insertions, 4 deletions
diff --git a/src/app/state.rs b/src/app/state.rs
index 315872f4..f7c4daa1 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -735,6 +735,29 @@ impl AppState {
(24, 80)
}
}
+
+ /// Returns true when the given (workspace, tab, pane) refers to the
+ /// currently focused pane in the active workspace's active tab.
+ pub fn is_active_pane(
+ &self,
+ ws_idx: usize,
+ tab_idx: usize,
+ pane_id: crate::layout::PaneId,
+ ) -> bool {
+ let Some(active_ws_idx) = self.active else {
+ return false;
+ };
+ if ws_idx != active_ws_idx {
+ return false;
+ }
+ let Some(ws) = self.workspaces.get(ws_idx) else {
+ return false;
+ };
+ if tab_idx != ws.active_tab_index() {
+ return false;
+ }
+ ws.active_tab().map(|tab| tab.layout.focused()) == Some(pane_id)
+ }
}
pub fn key_matches(
diff --git a/src/ui/sidebar.rs b/src/ui/sidebar.rs
index 36d1385a..04a3acd9 100644
--- a/src/ui/sidebar.rs
+++ b/src/ui/sidebar.rs
@@ -788,12 +788,29 @@ fn render_agent_detail(app: &AppState, frame: &mut Frame, area: Rect) {
break;
}
+ // Check if this agent entry corresponds to the active session
+ let is_active = app.is_active_pane(detail.ws_idx, detail.tab_idx, detail.pane_id);
+
let (icon, icon_style) = agent_icon(detail.state, detail.seen, app.spinner_tick, p);
let label_color = state_label_color(detail.state, detail.seen, p);
let label = state_label(detail.state, detail.seen);
- let name_style = Style::default().fg(p.subtext0).add_modifier(Modifier::BOLD);
- let status_style = Style::default().fg(label_color).add_modifier(Modifier::DIM);
+ let row_style = if is_active {
+ Style::default().bg(p.surface_dim)
+ } else {
+ Style::default()
+ };
+
+ let name_style = if is_active {
+ Style::default().fg(p.text).add_modifier(Modifier::BOLD)
+ } else {
+ Style::default().fg(p.subtext0).add_modifier(Modifier::BOLD)
+ };
+ let status_style = if is_active {
+ Style::default().fg(label_color)
+ } else {
+ Style::default().fg(label_color).add_modifier(Modifier::DIM)
+ };
let agent_style = Style::default().fg(p.overlay0).add_modifier(Modifier::DIM);
let primary_label =
@@ -805,7 +822,7 @@ fn render_agent_detail(app: &AppState, frame: &mut Frame, area: Rect) {
Span::styled(primary_label, name_style),
]);
frame.render_widget(
- Paragraph::new(name_line),
+ Paragraph::new(name_line).style(row_style),
Rect::new(body.x, row_y, body.width, 1),
);
row_y += 1;
@@ -819,7 +836,7 @@ fn render_agent_detail(app: &AppState, frame: &mut Frame, area: Rect) {
status_spans.push(Span::styled(agent_label, agent_style));
}
frame.render_widget(
- Paragraph::new(Line::from(status_spans)),
+ Paragraph::new(Line::from(status_spans)).style(row_style),
Rect::new(body.x, row_y, body.width, 1),
);
row_y += 1;