Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(hn): fill pane focus surfaces and simplify status details (#470)

Dee9ed9b90eeedd
diff --git a/docs/research/2026-09-29-hn-pane-ui-columns.png b/docs/research/2026-09-29-hn-pane-ui-columns.png
index c2804d3f2..0c3cbe555 100644
Binary files a/docs/research/2026-09-29-hn-pane-ui-columns.png and b/docs/research/2026-09-29-hn-pane-ui-columns.png differ
diff --git a/docs/research/2026-09-29-hn-pane-ui-light.png b/docs/research/2026-09-29-hn-pane-ui-light.png
index 2e051e437..d4ab44a81 100644
Binary files a/docs/research/2026-09-29-hn-pane-ui-light.png and b/docs/research/2026-09-29-hn-pane-ui-light.png differ
diff --git a/docs/research/2026-09-29-hn-pane-ui-rows.png b/docs/research/2026-09-29-hn-pane-ui-rows.png
index 3b088ab61..c5ac6deb9 100644
Binary files a/docs/research/2026-09-29-hn-pane-ui-rows.png and b/docs/research/2026-09-29-hn-pane-ui-rows.png differ
diff --git a/docs/research/2026-09-29-hn-pane-ui.md b/docs/research/2026-09-29-hn-pane-ui.md
index 955375dbe..82371713d 100644
--- a/docs/research/2026-09-29-hn-pane-ui.md
+++ b/docs/research/2026-09-29-hn-pane-ui.md
@@ -3,10 +3,11 @@
hn now presents terminal panes as quiet surfaces with space between them. Each pane has
an integrated title, a thin outline around the focused pane, and inset content. The status line stays
at the bottom in muted green, with tabs ordered `number:name* status`. Pane headers put the
-name before the state too: `hn ⋮ · project ⑂ branch`. Quota text is compact: `Claude 100%`,
-with amber or red only on the percentage. The branch appears only in pane headers; the
-bottom right keeps the familiar `machine:folder` location cue. Working and waiting
-indicators remain visible. Attention markers, prefix cues, inbox rows, connection notices, preview counters
+name before the state too: `hn ⋮` on the left, with `project ⑂ branch #123` aligned to the
+right. Quota text is compact: `Claude 100%`, with amber or red only on the percentage. The branch appears only in pane headers; the
+bottom right keeps the familiar `machine:folder` location cue. Status-bar groups have two spaces
+between them. Working and waiting indicators remain visible; idle dots are hidden in tabs and
+pane headers. Attention markers, prefix cues, inbox rows, connection notices, preview counters
and marked tree rows use text, symbols and emphasis instead of inverted badges. Cursor and
selection highlights, explicit user styles and program ANSI remain supported. Unread and bell
tabs keep their status symbols with bold text. The status bar has a continuous background;
@@ -38,11 +39,15 @@ At normal sizes there is a one-cell gap around the pane surfaces and between adj
one column of content padding on each side, and vertical padding where space permits. Small
panes automatically give these cells back to the program. A one-cell terminal remains responsive
and survives resizing.
-The focused pane keeps the terminal's native background and full text contrast. Other panes
+The focused pane keeps the terminal's native background and full text contrast, including
+padding and the cells behind its thin border. A black terminal stays black right to the outline. Other panes
use `rgb(64, 64, 64)` surfaces in dark terminals, with softer text so focus reads across the
-whole pane. Light terminals retain their light surface counterpart. The focused pane has a thin
+whole pane. The backdrop also fills outer padding and gaps, stopping at the status bar.
+Light terminals retain their light surface counterpart. A lone or zoomed pane uses its own
+background throughout, without a focus outline. In a split layout, the focused pane has a thin
outline in the existing gutter cells, which follows keyboard or mouse focus without shrinking
-program content or changing its mouse coordinates. Compact panes keep their usable cells. Surface colors follow the terminal's native light/dark theme and update when it changes. The
+program content or changing its mouse coordinates. Compact panes keep their usable cells.
+Surface colors follow the terminal's native light/dark theme and update when it changes. The
daemon receives the surface colors so its programs agree with their surrounding padding.
Program ANSI foregrounds, backgrounds and attributes remain intact; only default colors inherit
the pane surface palette. Explicit user styles and title formats still override the defaults.
@@ -61,7 +66,8 @@ exercises the running application with actual keys and SGR mouse input:
- All seven layouts and eight position targets with top, bottom and disabled pane titles.
- Identical split structure across appearances, including percentage splits on both axes.
- Application mouse coordinates after padding and after adding two status rows at the top.
-- Whole-pane focus contrast through keyboard and mouse selection, and name-before-status tabs.
+- Whole-pane focus contrast through keyboard and mouse selection, including gutters and outer padding.
+- Borderless single and zoomed panes, right-aligned branch context, and hidden idle indicators.
- Live light/dark theme changes, custom style overrides in active and inactive panes, and reported option defaults.
- Explicit program foreground/background colors; 80x24, 24x8, 6x4 and 1x1 terminals.
diff --git a/tui/README.md b/tui/README.md
index 3757ca792..324ef4efb 100644
--- a/tui/README.md
+++ b/tui/README.md
@@ -72,8 +72,11 @@ Splits, `resize-pane`, the seven layouts, `swap-pane`, `rotate-window`, `join-pa
and `select-pane` are tmux 3.5a's own arithmetic (layout.c, window.c): the same split sizes, the same
pane numbers and the same active pane after each. hn draws these layouts as pane surfaces
with one-cell gaps, inset terminal content and a thin outline around the focused pane. The
-surfaces follow the terminal's light/dark theme: the focused pane keeps full contrast;
-inactive dark panes use `rgb(64, 64, 64)` with softer text. Light terminals keep a light counterpart.
+surfaces follow the terminal's light/dark theme: the focused pane keeps full contrast and
+its background extends through the padding to the thin border;
+inactive dark panes use `rgb(64, 64, 64)` with softer text. This backdrop fills the padding
+and gaps up to the status bar. A lone or zoomed pane has no focus outline or gray surround.
+Light terminals keep a light counterpart.
Explicit program colors and user styles stay intact. The muted green status bar has a continuous
background, with tabs ordered `number:name* status` (previous window: `number:name- status`).
Quota warnings read `Claude 100%`, with amber or red only on the percentage. Padding
@@ -86,9 +89,11 @@ its project and branch where the pane has room), `allow-set-title off` (a pane's
harness's name, not what the program sets), `history-limit 10000` (agents print a lot; tmux keeps
2000), `mouse on`, `set-titles on` (the terminal's title: `?2 Fix flaky login test — Harness`, the
harnesses waiting on you and the one in front; `set-titles-string` changes it), and the status line:
-each window's most urgent harness state follows its name and tmux marker. Connection, quota,
+each window's most urgent harness state follows its name and tmux marker; idle dots are hidden
+in tabs and pane headers. Connection, quota,
fleet counts, `machine:folder` and clock sit on the right. The git branch stays in its pane
-header, written `⑂ branch` without redundant punctuation.
+header, aligned to the right with its PR and written `⑂ branch` without redundant punctuation.
+Status-bar groups are separated by two spaces.
One key differs on purpose: ⇧⏎
reaches the pane as `CSI 13;2u` (a new line in an agent's prompt; tmux, without `extended-keys`,
sends a plain Enter).
diff --git a/tui/src/options/mod.rs b/tui/src/options/mod.rs
index 390e460a6..4fc1cea7d 100644
--- a/tui/src/options/mod.rs
+++ b/tui/src/options/mod.rs
@@ -92,17 +92,17 @@ pub fn defaults() -> &'static BTreeMap<String, String> {
// Each pane's title row: the harness's name, then its state symbol, [watching — who
// has it] when another window has the pane to type in, and its project and branch
// where there is room. Git context stays here; the status bar keeps the location cue.
- m.insert("pane-border-format".into(), " #{pane_title}#{?pane_agent_icon, #{pane_agent_mark},}#{?pane_watched, #[fg=yellow][watching#{?pane_watcher, — #{pane_watcher} has it,}]#[fg=default],}#{?pane_where, #[dim]· #{pane_where} #[nodim],}".into());
+ m.insert("pane-border-format".into(), " #{pane_title}#{?#{==:#{pane_agent_state},idle},,#{?pane_agent_icon, #{pane_agent_mark},}}#{?pane_watched, #[fg=yellow][watching#{?pane_watcher, — #{pane_watcher} has it,}]#[fg=default],}#{?pane_where,#[align=right] #[dim]#{pane_where} #[nodim],}".into());
// Session and window navigation on the left; connection, quota, fleet, location and
// clock on the right. A leading space keeps a full window list from running into it.
m.insert("status-left".into(), "#{?client_prefix,#[bold],}[#{session_name}]#{?client_prefix, ›#[nobold],} ".into());
- m.insert("status-right".into(), " #{?daemon_down,#[bold]daemon down#[nobold] ,}#{?usage_high,#{usage_high_mark} ,}#{?fleet,#{fleet} ,}#{?pane_watching,[watching] ,}#{?pane_machine,#{=/12/…:pane_machine},#{host_short}}#{?pane_current_path,:#{=/18/…:#{b:pane_current_path}},#{?pane_project,:#{=/18/…:pane_project},}} %H:%M".into());
+ m.insert("status-right".into(), " #{?daemon_down,#[bold]daemon down#[nobold] ,}#{?usage_high,#{usage_high_mark} ,}#{?fleet,#{s/ / /:fleet} ,}#{?pane_watching,[watching] ,}#{?pane_machine,#{=/12/…:pane_machine},#{host_short}}#{?pane_current_path,:#{=/18/…:#{b:pane_current_path}},#{?pane_project,:#{=/18/…:pane_project},}} %H:%M".into());
// Each window's most urgent harness at a glance (the symbol its pane titles show) and its
// name in a few whole words (#{window_short_name}): a harness is named for its task.
// Keep tmux's familiar current/previous markers beside the name, then any other
// flags, then the harness state. The selected tab needs no filled badge.
for name in ["window-status-format", "window-status-current-format"] {
- m.insert(name.into(), "#I:#{window_short_name}#{?window_active,*,#{?window_last_flag,-,}}#{s/[*-]//:window_flags}#{?window_agent_icon, #{window_agent_icon},}".into());
+ m.insert(name.into(), "#I:#{window_short_name}#{?window_active,*,#{?window_last_flag,-,}}#{s/[*-]//:window_flags}#{?#{==:#{window_agent_state},idle},,#{?window_agent_icon, #{window_agent_icon},}}".into());
}
// Unread activity and bells already carry #/! markers. Keep a continuous status
// background and emphasize text instead of introducing inverted tab badges.
diff --git a/tui/src/theme.rs b/tui/src/theme.rs
index fb9e94359..6f2b86306 100644
--- a/tui/src/theme.rs
+++ b/tui/src/theme.rs
@@ -447,10 +447,12 @@ fn pane_palette_for(native: Option<(Color, Color)>) -> PanePalette {
Color::Rgb(c(ar, br), c(ag, bg), c(ab, bb))
};
let green = if light { Color::Rgb(58, 102, 48) } else { Color::Rgb(133, 181, 105) };
+ let inactive_surface = if light { mix(bg, foreground, 8) } else { Color::Rgb(64, 64, 64) };
PanePalette {
- canvas: if light { mix(bg, foreground, 14) } else { mix(bg, Color::Rgb(0, 0, 0), 45) },
+ // Inactive panes, gutters and outer space form one continuous backdrop.
+ canvas: inactive_surface,
surface: bg,
- inactive_surface: if light { mix(bg, foreground, 8) } else { Color::Rgb(64, 64, 64) },
+ inactive_surface,
foreground, inactive_foreground: mix(foreground, bg, 9),
muted: mix(foreground, bg, 30),
header: if light { mix(bg, foreground, 12) } else { Color::Rgb(64, 64, 64) },
@@ -1273,7 +1275,7 @@ mod palette_tests {
(Color::Rgb(247, 247, 247), Color::Rgb(26, 26, 26))] {
let p = super::pane_palette_for(Some((bg, fg)));
assert_ne!(p.surface, p.inactive_surface);
- assert_ne!(p.inactive_surface, p.canvas);
+ assert_eq!(p.inactive_surface, p.canvas);
assert_eq!(p.surface, bg);
assert_ne!(p.header, p.active_header);
assert_eq!(p.foreground, fg);
diff --git a/tui/src/ui.rs b/tui/src/ui.rs
index 84b3808a3..542d0d5ef 100644
--- a/tui/src/ui.rs
+++ b/tui/src/ui.rs
@@ -251,7 +251,9 @@ fn window(buf: &mut Buffer, app: &mut App, body: Rect) -> Option<Position> {
let window = if active { (a.fg.or(w.fg), a.bg.or(w.bg)) } else { (w.fg, w.bg) };
if surfaces {
let f = crate::pane_frame::frame(*rect, app.window_area(app.tab()), app.pane_status(app.tab()));
- buf.set_style(f.surface, Style::default().fg(window.0.unwrap_or(Color::Reset)).bg(window.1.unwrap_or(Color::Reset)));
+ // A lone or zoomed pane needs no focus treatment, including in its outer space.
+ let surface = if rects.len() == 1 { body } else { f.surface };
+ buf.set_style(surface, Style::default().fg(window.0.unwrap_or(Color::Reset)).bg(window.1.unwrap_or(Color::Reset)));
}
// choose-tree's tree, over the pane.
if app.panes.get(id).map(|p| p.tree_top()).unwrap_or(false) {
@@ -287,10 +289,14 @@ fn pane_chrome(buf: &mut Buffer, app: &App) {
let f = crate::pane_frame::frame(*rect, canvas, app.pane_status(app.tab()));
let active = Some(*id) == app.focused();
let style = app.style_of(if active { "pane-active-border-style" } else { "pane-border-style" }, app.active, Some(*id));
- if let Some(outline) = f.outline.filter(|_| active) {
+ if let Some(outline) = f.outline.filter(|_| active && app.rects.len() > 1) {
let lines = app.options.get("pane-border-lines", &app.tab().id, Some(*id)).unwrap_or_default();
let (tl, tr, bl, br, hz, vt, _, _) = box_set(&lines);
- let border = style.bg(theme::pane_palette().canvas);
+ // The thin outline is drawn over the pane's own background, so the canvas
+ // cannot leave a gray band between the content and the border glyphs.
+ let a = app.style_of("window-active-style", app.active, Some(*id));
+ let w = app.style_of("window-style", app.active, Some(*id));
+ let border = style.bg(a.bg.or(w.bg).unwrap_or(Color::Reset));
let put = |buf: &mut Buffer, x, y, glyph| {
if let Some(cell) = buf.cell_mut((x, y)) { cell.set_symbol(glyph).set_style(border); }
};
diff --git a/tui/tests/e2e.sh b/tui/tests/e2e.sh
index a8e6dfd92..c91a2443d 100755
--- a/tui/tests/e2e.sh
+++ b/tui/tests/e2e.sh
@@ -61,7 +61,9 @@ tmux_ send-keys -t t 'Mock\ Claude'
expect "fuzzy filter narrows" "1/"
# Enter, as tmux's chooser: the harness in a window of its own (not a split of this one).
tmux_ send-keys -t t Enter
-expect "C-b s Enter: a window of its own, name before status" "1:Mock Claude* ·"
+expect "C-b s Enter: a window of its own, name before status" "1:Mock Claude*"
+idle_tab() { hn display -p "$(hn show -gwv window-status-current-format)"; }
+wait_eq "idle windows have no status dot" "1:Mock Claude*" idle_tab
wait_eq "the harness window's one pane" "1" hn display -p '#{window_panes}'
hn kill-window
tmux_ send-keys -t t C-b s
diff --git a/tui/tests/pane-ui.py b/tui/tests/pane-ui.py
index 942834f0c..dbb7a8d09 100644
--- a/tui/tests/pane-ui.py
+++ b/tui/tests/pane-ui.py
@@ -31,7 +31,7 @@ ENV.update(HOME=str(BASE), HN_TMPDIR=str(BASE), HN_SOCKET_NAME=PREFIX, PORT=str(
TERM='xterm-256color', COLORTERM='truecolor', SHELL='/bin/sh', HARNESS_TUI_DESK='sync',
HARNESS_TUI_NOTIFY='off', HN_DESKTOP='off', MOCK_DEMO='1', MOCK_RECONNECT='1', MOCK_USAGE='100')
CONF = BASE / 'tmux.conf'
-CONF.write_text('set -g automatic-rename off\nset -g status-right "#{usage_high_mark} #{fleet} #{pane_machine}:#{b:pane_current_path} 20:41 "\n')
+CONF.write_text('set -g automatic-rename off\nset -g status-right "#{usage_high_mark} #{s/ / /:fleet} #{pane_machine}:#{b:pane_current_path} 20:41 "\n')
OUTPUT = Path(os.environ['HN_PANE_UI_OUTPUT']) if os.environ.get('HN_PANE_UI_OUTPUT') else None
if OUTPUT:
OUTPUT.mkdir(parents=True, exist_ok=True)
@@ -106,6 +106,18 @@ def background_at(x, y):
return bg
+def background(hex_value):
+ raw = f'\x1b]11;{hex_value}\x07'.encode()
+ tmux('send-keys', '-H', '-t', 'test', *[f'{b:02x}' for b in raw])
+
+
+def pane_edge_background(pane, colour):
+ x, y, w, h = map(int, value('#{pane_left} #{pane_top} #{pane_width} #{pane_height}', pane).split())
+ points = ((x - 2, y - 3), (x + w + 1, y - 3), (x - 2, y + h + 1),
+ (x + w + 1, y + h + 1), (x - 1, y - 1), (x + w, y + h))
+ return all(background_at(col, row) == colour for col, row in points)
+
+
def pane_background(pane):
x, y, height = map(int, value('#{pane_left} #{pane_top} #{pane_height}', pane).split())
return background_at(x, y + height - 2)
@@ -148,6 +160,8 @@ try:
tmux('-f', '/dev/null', 'new-session', '-d', '-s', 'test', '-x', '150', '-y', '42', command)
started = True
wait(lambda: 'Fix flaky login test' in tmux('capture-pane', '-p', '-t', 'test'), 'demo panes')
+ background('#000000')
+ wait(lambda: 'bg=#000000' in hn('show', '-gwv', 'window-active-style'), 'black terminal background')
hn('select-layout', 'even-horizontal')
panes = hn('list-panes', '-F', '#{pane_id}').splitlines()
assert len(panes) == 3
@@ -161,9 +175,12 @@ try:
active_bg = hn('show', '-gwv', 'window-active-style').split('bg=')[1]
inactive_bg = hn('show', '-gwv', 'window-style').split('bg=')[1]
assert active_bg != inactive_bg
- assert inactive_bg == '#404040'
+ assert active_bg == '#000000' and inactive_bg == '#404040'
wait(lambda: pane_outline(first) and not pane_outline(second), 'thin outline only around the focused pane')
wait(lambda: pane_background(first) == active_bg and pane_background(second) == inactive_bg, 'whole-pane focus contrast')
+ assert background_at(149, 0) == inactive_bg, 'gray backdrop includes outer padding'
+ wait(lambda: pane_edge_background(first, active_bg), 'focused background fills padding and border cells')
+ assert background_at(99, 20) == inactive_bg, 'gray backdrop includes the unfocused split gutter'
tab = value(hn('show', '-gwv', 'window-status-current-format'))
label = value('#{window_index}:#{window_short_name}')
assert tab.startswith(label + '* '), (tab, label)
@@ -205,6 +222,7 @@ try:
wait(lambda: value('#{pane_id}') == second, 'C-b Right with insets')
wait(lambda: pane_background(second) == active_bg and pane_background(first) == inactive_bg, 'keyboard focus moves pane contrast')
wait(lambda: pane_outline(second) and not pane_outline(first), 'keyboard focus moves the outline without stale borders')
+ wait(lambda: pane_edge_background(second, active_bg), 'focused border background follows keyboard selection')
keys('C-b', 'Right')
wait(lambda: value('#{pane_id}') == third, 'second C-b Right')
keys('C-b', 'Right')
@@ -214,6 +232,11 @@ try:
branch_context = value('#{pane_where}')
assert '⑂ ' + value('#{pane_branch}') in branch_context, branch_context
assert 'git:(' not in branch_context
+ wait(lambda: not pane_outline(first) and background_at(0, 0) == active_bg, 'zoomed pane has no border or gray surround')
+ assert background_at(0, 41) == normal_bg, 'status bar keeps its own color'
+ x, y, w = map(int, value('#{pane_left} #{pane_top} #{pane_width}', first).split())
+ wait(lambda: tmux('capture-pane', '-p', '-t', 'test').splitlines()[y - 2][x:x + w].rstrip().endswith(branch_context), 'branch and PR align to the right edge')
+ snapshot('panes-zoomed')
keys('C-b', 'z')
wait(lambda: value('#{window_zoomed_flag}') == '0', 'unzoom')
assert value('#{window_layout}') == original
@@ -316,14 +339,12 @@ try:
hn('set', '-g', 'status-position', 'bottom')
hn('set', '-g', 'status', 'on')
# OSC replies are metadata, not keystrokes. Surface defaults follow live light/dark changes.
- def background(hex_value):
- raw = f'\x1b]11;{hex_value}\x07'.encode()
- tmux('send-keys', '-H', '-t', 'test', *[f'{b:02x}' for b in raw])
layout_before_theme = value('#{window_layout}')
before = len(api()['inputs'])
background('#f7f7f7')
wait(lambda: hn('show', '-gwv', 'window-active-style') == 'fg=#1a1a1a,bg=#f7f7f7', 'light surface defaults')
wait(lambda: pane_background(first) == '#f7f7f7' and pane_background(second) == '#e5e5e5', 'light focus contrast')
+ wait(lambda: pane_edge_background(first, '#f7f7f7'), 'light surface continues through the focus border')
light_status = hn('show', '-gv', 'status-style')
assert value('#{window_layout}') == layout_before_theme
snapshot('panes-light')
@@ -333,6 +354,7 @@ try:
assert hn('show', '-gwv', 'window-style') == 'fg=red,bg=blue'
assert hn('show', '-gwv', 'window-active-style') == 'default'
wait(lambda: pane_background(first) == 'colour4' and pane_background(second) == 'colour4', 'custom backgrounds win on active and inactive panes')
+ wait(lambda: pane_edge_background(first, 'colour4'), 'custom pane background continues through the focus border')
assert len(api()['inputs']) == before, 'terminal query replies reached an application'
hn('set', '-gwu', 'window-style')
assert hn('show', '-gwv', 'window-active-style').startswith('fg=#f5f5f5,')
@@ -350,6 +372,14 @@ try:
wait(lambda: value('#{client_width} #{client_height}') == f'{width} {height}', 'terminal resize')
assert value('#{window_panes}') == '3'
print('PASS pane UI: compact and one-cell terminals, return to full size', flush=True)
+
+ single = hn('new-window', '-n', 'single', '-P', '-F', '#{pane_id}', '/bin/sh')
+ wait(lambda: value('#{pane_id}') == single and value('#{window_panes}') == '1', 'single-pane window')
+ wait(lambda: not pane_outline(single) and background_at(0, 0) == '#101010', 'single pane has no outline or gray surround')
+ snapshot('panes-single')
+ hn('kill-window')
+ wait(lambda: value('#{window_id}') == current, 'return from single-pane window')
+ print('PASS pane UI: full backdrop, right-aligned context and single-pane presentation', flush=True)
finally:
if started:
if OUTPUT: