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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
hn: boxes that touch, dim other panes, no scrollbars, a second prefix
Tim293b10a784ef
diff --git a/tui/src/app.rs b/tui/src/app.rsindex b3a40dd91..fd1775e24 100644--- a/tui/src/app.rs+++ b/tui/src/app.rs@@ -5146,6 +5146,7 @@ impl App {("@hn-status-bar", format!("status bar: {value}"))}"border_style" => ("@hn-border", format!("border style: {value}")),+ "dim" => ("@hn-dim", format!("dim other panes: {value}")),_ => return format!("unknown: {value}"),};let _ = self.options.set(name, Some(value), &global, "", 0);@@ -5173,6 +5174,7 @@ impl App {look.status_bar = self.options.get("@hn-status-bar", "", None);look.border_style = self.options.get("@hn-border", "", None);look.status_bar_width = self.options.get("@hn-status-bar-width", "", None);+ look.dim = self.options.get("@hn-dim", "", None);if let Err(e) = crate::config::write_look(&look) { self.say(format!("could not write tui.toml: {e}"), crate::theme::DANGER) }}diff --git a/tui/src/bar.rs b/tui/src/bar.rsindex 801584fe9..b5d803be8 100644--- a/tui/src/bar.rs+++ b/tui/src/bar.rs@@ -138,7 +138,7 @@ fn colours() -> Colours {}let fit = theme::depth_fit;Colours {- bg: fit(pal.surface), row: fit(mix(pal.surface, pal.foreground, 12)), rule: fit(pal.border),+ bg: fit(pal.background), row: fit(mix(pal.background, pal.foreground, 12)), rule: fit(pal.border),text: fit(pal.foreground), soft: fit(pal.inactive_foreground), muted: fit(pal.muted), accent: theme::paint(theme::accent()),green: theme::paint(theme::ONLINE),}@@ -831,10 +831,11 @@ mod tests {let frame = |id: u64| { let r = app.rects.iter().find(|(p, _)| *p == id).map(|(_, r)| *r).unwrap(); crate::pane_frame::boxed_in(r, app.window_area(app.tab()), app.box_inner(app.tab()), app.pane_status(app.tab())).surface };let (left, top_right, below) = (frame(1), frame(2), frame(3));let mid = left.y + left.height / 2;- // The left box's right edge, one blank cell, the right box's left edge.+ // The left box's right edge, then at once the right box's left edge: `││`.assert_eq!(buf[(left.right() - 1, mid)].symbol(), "│", "{s}");- assert_eq!(buf[(left.right(), mid)].symbol(), " ", "a gap between the boxes:\n{s}");+ assert_eq!(top_right.x, left.right(), "the boxes touch:\n{s}");assert_eq!(buf[(top_right.x, top_right.y + 1)].symbol(), "│", "{s}");+ assert_eq!(buf[(left.right() - 1, left.y)].symbol(), "┐", "each box its own corners, not a joint:\n{s}");assert_eq!(buf[(left.x, left.y)].symbol(), "┌");assert_eq!(buf[(top_right.x, top_right.y)].symbol(), "┌", "the right box is its own, not a joint:\n{s}");let (accent, attention) = (theme::paint(theme::accent()), theme::paint(theme::ATTENTION));@@ -846,12 +847,12 @@ mod tests {assert_eq!(app.content_of(app.tab(), app.rects.iter().find(|(p, _)| *p == 1).unwrap().1), Rect::new(left.x + 1, left.y + 1, left.width - 2, left.height - 2));}- /// Two panes next to each other have one cell between them — across and down, boxes or- /// blurred surfaces, pane titles off and on top, the status line at the bottom or the bar at a- /// side: never each pane's space added to the other's. At the window's edges and the status- /// line a pane has none (beside the bar, its blank edge is the one cell).+ /// Two boxes next to each other touch (`││`); two blurred surfaces have one cell between+ /// them — across and down, pane titles off and on top, the status line at the bottom or the+ /// bar at a side: never each pane's space added to the other's. At the window's edges and the+ /// status line a pane has none (beside the bar, its blank edge is the one cell).#[test]- fn panes_side_by_side_have_one_cell_between_and_none_at_the_edges() {+ fn panes_side_by_side_touch_or_are_a_cell_apart_and_meet_the_edges() {for focus in ["line", "surface"] { for (side, titles) in [("bottom", "off"), ("bottom", "top"), ("left", "off"), ("left", "top"), ("right", "top")] {let mut app = app((120, 36), side);let global = crate::options::SetFlags { global: true, ..Default::default() };@@ -861,17 +862,22 @@ mod tests {let (s, _) = screen(&mut app);let tab = app.tab();let (canvas, inner, status) = (app.window_area(tab), app.box_inner(tab), app.pane_status(tab));- let f: Vec<Rect> = [1, 2, 3].iter().map(|id| { let r = app.rects.iter().find(|(p, _)| p == id).unwrap().1; crate::pane_frame::frame(r, canvas, inner, status).surface }).collect();+ let boxes = focus == "line";+ let f: Vec<Rect> = [1, 2, 3].iter().map(|id| {+ let r = app.rects.iter().find(|(p, _)| p == id).unwrap().1;+ if boxes { crate::pane_frame::boxed_in(r, canvas, inner, status).surface } else { crate::pane_frame::frame(r, canvas, inner, status).surface }+ }).collect();+ let gap = if boxes { 0 } else { 1 };let at = format!("{focus}, {side}, titles {titles}:\n{s}");// Across: the left edge (the bar's blank column when it is on the left), between, the right edge.assert_eq!(f[0].x, canvas.x, "left edge {at}");if side == "left" { assert_eq!(canvas.x, app.bar_width(), "the bar's blank edge is the gap {at}"); }- assert_eq!(f[1].x - f[0].right(), 1, "between, across {at}");+ assert_eq!(f[1].x - f[0].right(), gap, "between, across {at}");assert_eq!(f[1].right(), canvas.right(), "right edge {at}");if side == "right" { assert_eq!(app.size.0 - app.bar_width(), canvas.right(), "the bar's blank edge is the gap {at}"); }// Down: the top edge, between the two stacked panes, the bottom edge (the status line).assert_eq!(f[0].y, canvas.y, "top edge {at}");- assert_eq!(f[2].y - f[1].bottom(), 1, "between, down {at}");+ assert_eq!(f[2].y - f[1].bottom(), gap, "between, down {at}");assert_eq!((f[0].bottom(), f[2].bottom()), (canvas.bottom(), canvas.bottom()), "bottom edge {at}");} }}diff --git a/tui/src/bar_more.rs b/tui/src/bar_more.rsindex dc5a8b0cd..52ef9b39d 100644--- a/tui/src/bar_more.rs+++ b/tui/src/bar_more.rs@@ -45,7 +45,7 @@ pub fn footer_height(app: &App, width: u16) -> u16 {pub fn footer(buf: &mut Buffer, app: &App, r: Rect) {if r.height == 0 || r.width < 4 { return }let pal = theme::pane_palette();- let base = Style::default().fg(theme::paint(pal.muted)).bg(theme::depth_fit(pal.surface));+ let base = Style::default().fg(theme::paint(pal.muted)).bg(theme::depth_fit(pal.background));for x in r.x..r.right() { if let Some(c) = buf.cell_mut((x, r.y)) { c.set_symbol("─").set_style(Style::default().fg(theme::paint(pal.border)).bg(base.bg.unwrap_or_default())); } }for (row, item) in items(app).iter().take(r.height.saturating_sub(1) as usize).enumerate() {let y = r.y + 1 + row as u16;diff --git a/tui/src/commands.rs b/tui/src/commands.rsindex 31c04342e..24fcc8f6c 100644--- a/tui/src/commands.rs+++ b/tui/src/commands.rs@@ -1248,6 +1248,7 @@ fn after_set(app: &mut App, name: &str, now: Option<String>, global: bool, tab:if matches!(name.as_str(), "@hn-accent" | "@hn-theme" | "@hn-lists") { app.sync_accent(); app.redraw_all = true }// (The bar down a side and the pane frames change the panes' room.)if matches!(name.as_str(), "@hn-status-bar" | "@hn-border" | "@hn-focus") { app.redraw_all = true; app.fit_panes(); }+ if name == "@hn-dim" { app.redraw_all = true }// alerts_reset_all: every window's silence timer starts again.if name == "monitor-silence" { for t in app.tabs.iter_mut() { t.last_output = std::time::Instant::now() } }if name.starts_with('@') && now.is_none() { app.opts.user.remove(&name); return }diff --git a/tui/src/config.rs b/tui/src/config.rsindex c20a3bfdb..57aaa1f22 100644--- a/tui/src/config.rs+++ b/tui/src/config.rs@@ -2,6 +2,7 @@//!//! ```toml//! prefix = "ctrl+a" # instead of ctrl+space+//! prefix2 = "C-b" # a second one (⌘ keys reach only some terminals)//! desk = "read" # sync | read | off (as HARNESS_TUI_DESK)//! predict = "off" # auto | always | off (as HARNESS_TUI_PREDICT)//! notify = false # OS notifications through the terminal@@ -132,12 +133,17 @@ pub struct Look {pub border_style: Option<String>,/// The bar's width down a side, in columns (18-36; 26 unless dragged).pub status_bar_width: Option<String>,+ /// `on`: the panes you are not in, a little quieter (`off` unless chosen).+ pub dim: Option<String>,}pub struct Config {pub prefix: Chord,/// Whether the file named a prefix (else tmux's, or ~/.tmux.conf's, stands).pub prefix_set: bool,+ /// A second prefix (tmux's prefix2), where the file names one: `prefix = "D-b"` (⌘B, which+ /// only some terminals pass on) with `prefix2 = "C-b"` works in every terminal.+ pub prefix2: Option<Chord>,pub keys: Vec<(Chord, Option<String>)>,/// The `[look]` table, if any.pub look: Option<Look>,@@ -191,13 +197,14 @@ impl Look {}if let Some(b) = &self.border_style { out.push(("@hn-border".into(), b.clone())) }if let Some(w) = &self.status_bar_width { out.push(("@hn-status-bar-width".into(), w.clone())) }+ if let Some(d) = &self.dim { out.push(("@hn-dim".into(), d.clone())) }out}}impl Default for Config {fn default() -> Self {- Config { prefix: Chord::normal(KeyCode::Char('b'), KeyModifiers::CONTROL), prefix_set: false, keys: Vec::new(), look: None, problems: Vec::new() }+ Config { prefix: Chord::normal(KeyCode::Char('b'), KeyModifiers::CONTROL), prefix_set: false, prefix2: None, keys: Vec::new(), look: None, problems: Vec::new() }}}@@ -224,6 +231,9 @@ pub fn load() -> Config {if let Some(p) = value.get("prefix").and_then(|v| v.as_str()) {match crate::keys::parse(p) { Ok(c) => { config.prefix = c; config.prefix_set = true } Err(e) => config.problems.push(format!("tui.toml prefix: {e}")) }}+ if let Some(p) = value.get("prefix2").and_then(|v| v.as_str()) {+ match crate::keys::parse(p) { Ok(c) => config.prefix2 = Some(c), Err(e) => config.problems.push(format!("tui.toml prefix2: {e}")) }+ }if let Some(d) = value.get("desk").and_then(|v| v.as_str()) { setenv("HARNESS_TUI_DESK", d) }if let Some(p) = value.get("predict").and_then(|v| v.as_str()) { setenv("HARNESS_TUI_PREDICT", p) }if let Some(false) = value.get("notify").and_then(|v| v.as_bool()) { setenv("HARNESS_TUI_NOTIFY", "off") }@@ -264,6 +274,7 @@ fn look_of(look: &toml::Table, problems: &mut Vec<String>) -> Look {field(look, "status_bar", &mut l.status_bar);field(look, "border_style", &mut l.border_style);field(look, "status_bar_width", &mut l.status_bar_width);+ field(look, "dim", &mut l.dim);// (An older file's `tabs` is left alone: the tabs over the panes are gone, the bar lists the windows.)l}@@ -299,6 +310,7 @@ fn format_look(look: &Look) -> String {push(&look.status_bar, "status_bar", &mut s);push(&look.border_style, "border_style", &mut s);push(&look.status_bar_width, "status_bar_width", &mut s);+ push(&look.dim, "dim", &mut s);s}diff --git a/tui/src/input.rs b/tui/src/input.rsindex 546c1410c..323bf2534 100644--- a/tui/src/input.rs+++ b/tui/src/input.rs@@ -2705,7 +2705,9 @@ fn choose(app: &mut App, kind: PickerKind, mut picker: Picker, choice: Choice) {let msg = app.set_look(knob, value);picker.say(msg);picker.set_rows(modal::theme_options(app, §ion));- crate::settings::cursor_to(&mut picker, &id);+ // (A switch — Dim other panes — is the same row turned over.)+ let at = if knob == "dim" { format!("dim:{}", if value == "on" { "off" } else { "on" }) } else { id.clone() };+ crate::settings::cursor_to(&mut picker, &at);}} else if let Some(sec) = id.strip_prefix("section:") {// The section list: Enter opens the section's options.diff --git a/tui/src/main.rs b/tui/src/main.rsindex 2261e0ea0..e495e77b6 100644--- a/tui/src/main.rs+++ b/tui/src/main.rs@@ -169,6 +169,7 @@ async fn run_headless(config: config::Config, port: u16) -> io::Result<()> {app.cfg_finished = true;app.config_files = read;if config.prefix_set { app.keymap.prefix = config.prefix }+ if config.prefix2.is_some() { app.keymap.prefix2 = config.prefix2 }app.apply_look(config.look.as_ref());// The server's options, keys, buffers and environment: this client's if it is the first.server::join(&mut app);@@ -252,6 +253,7 @@ async fn run(config: config::Config) -> io::Result<()> {let mut km = keys::Keymap::tmux_defaults();let settings = tmuxconf::load(&mut km);if config.prefix_set { km.prefix = config.prefix }+ if config.prefix2.is_some() { km.prefix2 = config.prefix2 }let mut text = String::new();for p in &settings.paths { text += &format!("read {}\n", p.display()) }text += &format!("prefix {}\n\n", keys::name(&km.prefix));@@ -425,6 +427,7 @@ async fn run(config: config::Config) -> io::Result<()> {app.cfg_finished = true;app.config_files = read.clone();if config.prefix_set { app.keymap.prefix = config.prefix }+ if config.prefix2.is_some() { app.keymap.prefix2 = config.prefix2 }app.apply_look(config.look.as_ref());for (chord, command) in &config.keys {match command { Some(c) => app.keymap.bind(keys::Table::Root, *chord, c.clone(), false), None => app.keymap.unbind(keys::Table::Root, chord) }diff --git a/tui/src/modal.rs b/tui/src/modal.rsindex 8db5a163d..daaa51d2e 100644--- a/tui/src/modal.rs+++ b/tui/src/modal.rs@@ -563,7 +563,9 @@ pub fn theme_sections(app: &App) -> Vec<Row> {let o = &app.options;let status = o.get("pane-border-status", "", None).unwrap_or_else(|| "top".into());// (Named as its options are: the highlighted border, or the rest blurred.)- let focus = if o.focus_style() == "surface" { "blurred" } else { "border" };+ // (And, with either, the other panes dimmed or not.)+ let focus = format!("{}{}", if o.focus_style() == "surface" { "blurred" } else { "border" }, if o.dim_others() { " · dim" } else { "" });+ let focus = focus.as_str();let orientation = o.look_orientation().to_string();let layout_preset = o.get("@hn-layout-preset", "", None).unwrap_or_else(|| "auto".into());let theme = o.get("@hn-theme", "", None).unwrap_or_default();@@ -592,7 +594,7 @@ pub fn theme_sections(app: &App) -> Vec<Row> {fn status_bar_of(app: &App) -> &'static str { match app.options.status_bar() { "bottom" if app.status_top => "top", b => b } }/// How panes are set apart: `box` unless `@hn-border line`.-fn border_style_of(app: &App) -> &'static str { if app.options.get("@hn-border", "", None).as_deref() == Some("line") { "line" } else { "box" } }+fn border_style_of(app: &App) -> &'static str { app.options.border_style() }/// The look/theme picker, level two: the options of one section. Enter on one applies it (and the/// ▼ moves to it); Left/Esc returns to the section list.@@ -612,7 +614,13 @@ pub fn theme_options(app: &App, section: &str) -> Vec<Row> {"border" => { let cur = current("pane-border-lines", "single");["single", "double", "heavy", "simple", "number"].iter().map(|v| opt(format!("border_lines:{v}"), *v, cur == *v, "pane-border-lines")).collect() }"focus" => { let cur = o.focus_style().to_string();- ["line", "surface"].iter().map(|v| opt(format!("focus:{v}"), if *v == "line" { "border" } else { "blurred" }, cur == *v, "focus_style")).collect() }+ let styles = ["line", "surface"].iter().map(|v| opt(format!("focus:{v}"), if *v == "line" { "border" } else { "blurred" }, cur == *v, "focus_style"));+ // With either: the panes you are not in, a little quieter — a switch (Enter turns it+ // over; the preview shows it turned).+ let on = o.dim_others();+ let dim = Row::new(if on { "dim:off" } else { "dim:on" }, "Dim other panes").lead(lead(on))+ .detail(vec![span(if on { "on" } else { "the panes you are not in, a little quieter" }, fg(theme::MUTED))]);+ styles.chain(std::iter::once(dim)).collect() }"split" => { let cur = o.look_orientation().to_string();["auto", "vertical", "horizontal"].iter().map(|v| opt(format!("layout_orientation:{v}"), *v, cur == *v, "layout_orientation")).collect() }"layout" => { let cur = current("@hn-layout-preset", "auto");@@ -791,6 +799,14 @@ mod theme_row_tests {let _ = app.set_look("border_style", "line");assert_eq!(picked(theme_options(&app, "bar")).as_deref(), Some("status_bar:left"));assert_eq!(picked(theme_options(&app, "boxes")).as_deref(), Some("border_style:line"));+ // Dim other panes, in Focus under border and blurred: off until chosen, a switch its row+ // turns over.+ let focus = ids(theme_options(&app, "focus"));+ assert_eq!(focus, ["focus:line", "focus:surface", "dim:on"]);+ let _ = app.set_look("dim", "on");+ assert!(app.options.dim_others());+ assert_eq!(ids(theme_options(&app, "focus"))[2], "dim:off");+ assert!(theme_sections(&app).iter().any(|r| r.id == "section:focus" && r.right == "border · dim"));let rows = theme_sections(&app);let right = |id: &str| rows.iter().find(|r| r.id == id).map(|r| r.right.clone()).unwrap_or_default();assert_eq!((right("section:bar"), right("section:boxes")), ("left".into(), "off".into()));diff --git a/tui/src/options/mod.rs b/tui/src/options/mod.rsindex bd299c47c..2ae0c771a 100644--- a/tui/src/options/mod.rs+++ b/tui/src/options/mod.rs@@ -277,11 +277,23 @@ impl Store {}/// `@hn-border` box (the default): every pane its own frame, a cell apart. `line` is tmux's- /// shared lines; the blurred surfaces, `@hn-look tmux` and `@hn-look classic` (the earlier- /// line borders) draw as they always have.+ /// shared lines; the blurred surfaces and `@hn-look tmux` draw as they always have.pub fn box_panes(&self) -> bool {- !self.tmux_look() && !self.pane_look() && self.get("@hn-look", "", None).as_deref() != Some("classic")- && self.get("@hn-border", "", None).as_deref() != Some("line")+ !self.tmux_look() && !self.pane_look() && self.border_style() == "box"+ }++ /// `@hn-dim on` (tui.toml `dim`): the panes you are not in, a little quieter — with borders or+ /// blurred surfaces alike. Off unless chosen.+ pub fn dim_others(&self) -> bool { self.get("@hn-dim", "", None).as_deref() == Some("on") }++ /// `@hn-border` as chosen — or, not chosen, `box` except under `@hn-look classic` (a look+ /// from before boxes, whose panes keep their lines until you choose).+ pub fn border_style(&self) -> &'static str {+ match self.get("@hn-border", "", None).as_deref() {+ Some("line") => "line",+ Some(_) => "box",+ None => if self.get("@hn-look", "", None).as_deref() == Some("classic") { "line" } else { "box" },+ }}/// The default for a name: hn's, or tmux's under `@hn-look tmux`.diff --git a/tui/src/pane_frame.rs b/tui/src/pane_frame.rsindex 7a14ce2ab..df8a6e1d5 100644--- a/tui/src/pane_frame.rs+++ b/tui/src/pane_frame.rs@@ -7,36 +7,44 @@ use crate::layout::Status;#[derive(Clone, Copy, Debug)]pub struct Frame { pub surface: Rect, pub content: Rect, pub title: Option<Rect> }-/// A pane as a blurred surface: a box's cells ([boxed_in]) with no line drawn — the surface-/// filled, its edge cell the padding where a box has its line, the title in its top (or bottom)-/// row. So the space between two panes is one cell, as between boxes, never each pane's own-/// padding added to its neighbour's.-pub fn frame(tile: Rect, canvas: Rect, inner: Rect, status: Status) -> Frame { boxed_in(tile, canvas, inner, status) }+/// A pane as a blurred surface: the surface filled, its edge cell padding, the title in its top+/// (or bottom) row. The cell tmux keeps between panes — its divider, or a lower pane's title row+/// — is left empty, so two surfaces of one colour never run together: one cell between them, never+/// each pane's own padding added to its neighbour's.+pub fn frame(tile: Rect, canvas: Rect, inner: Rect, status: Status) -> Frame { cells(tile, canvas, inner, status, false) }// ── box panes ──/// A pane as a box (`@hn-border box`): its own single-line frame on the pane's outer cells-/// (`surface`), the program inside it. The cell tmux keeps between panes — its divider, or a lower-/// pane's title row — is left empty: a gap, so each pane reads as a box of its own (never two-/// panes on one line). The title goes into the frame's top (or bottom) line (`title`), the top-/// pane's own title row being its frame's top line. The layout's cells stay tmux's, so splits,-/// resizes and layouts are unchanged.+/// (`surface`), the program inside it. Boxes side by side, or stacked, touch — `││`, never a+/// blank between — each with a frame of its own (never two panes on one line): a box takes the+/// cell tmux keeps after it (its divider) for its right or bottom line, and a lower pane's title+/// row is its frame's top line. The title goes into the frame's top (or bottom) line (`title`).+/// The layout's cells stay tmux's, so splits, resizes and layouts are unchanged.#[cfg(test)]pub fn boxed(tile: Rect, canvas: Rect, status: Status) -> Frame { boxed_in(tile, canvas, canvas, status) }-/// [boxed], every frame kept inside [inner]: the window less a cell at each edge that has no gap-/// of its own (`App::box_inner`) — so the space around a box is one cell everywhere, at the-/// window's edges as between two boxes, never two.-pub fn boxed_in(tile: Rect, canvas: Rect, inner: Rect, status: Status) -> Frame {+/// [boxed], every frame kept inside [inner] (`App::box_inner`: the window).+pub fn boxed_in(tile: Rect, canvas: Rect, inner: Rect, status: Status) -> Frame { cells(tile, canvas, inner, status, true) }++/// A pane's surface, content and title: [touch] for boxes (the divider after a pane is its+/// line), else a surface a cell apart from the next.+fn cells(tile: Rect, canvas: Rect, inner: Rect, status: Status, touch: bool) -> Frame {let mut outer = tile;- match status {- Status::Top if tile.y != canvas.y => { outer.y += 1; outer.height = outer.height.saturating_sub(1) }- Status::Bottom if tile.bottom() != canvas.bottom() => outer.height = outer.height.saturating_sub(1),- _ => {}+ if touch {+ // The divider column after a pane, and (titles off) the divider row below it.+ if tile.right() < canvas.right() { outer.width += 1 }+ if status == Status::Off && tile.bottom() < canvas.bottom() { outer.height += 1 }+ } else {+ match status {+ Status::Top if tile.y != canvas.y => { outer.y += 1; outer.height = outer.height.saturating_sub(1) }+ Status::Bottom if tile.bottom() != canvas.bottom() => outer.height = outer.height.saturating_sub(1),+ _ => {}+ }}outer = outer.intersection(inner);// Too small for a frame with something in it: the program has every cell.- if outer.width < 3 || outer.height < 3 { let cells = if outer.height == 0 { tile } else { outer }; return Frame { surface: cells, content: cells, title: None } }+ if outer.width < 3 || outer.height < 3 || tile.width < 3 || tile.height < 3 { let cells = if outer.height == 0 { tile } else { outer.intersection(tile) }; return Frame { surface: cells, content: cells, title: None } }let content = Rect::new(outer.x + 1, outer.y + 1, outer.width - 2, outer.height - 2);let title = (status != Status::Off).then(|| Rect::new(outer.x + 1, if status == Status::Bottom { outer.bottom() - 1 } else { outer.y }, outer.width - 2, 1));Frame { surface: outer, content, title }@@ -47,21 +55,19 @@ mod tests {use super::*;#[test]- fn blurred_surfaces_sit_where_the_boxes_do() {+ fn blurred_surfaces_are_a_cell_apart() {let canvas = Rect::new(0, 0, 120, 40);- let inner = Rect::new(1, 1, 118, 38);for status in [Status::Off, Status::Top, Status::Bottom] {- let (left, right) = (frame(Rect::new(0, 0, 59, 40), canvas, inner, status), frame(Rect::new(60, 0, 60, 40), canvas, inner, status));+ let (left, right) = (frame(Rect::new(0, 0, 59, 40), canvas, canvas, status), frame(Rect::new(60, 0, 60, 40), canvas, canvas, status));assert_eq!(right.surface.x - left.surface.right(), 1, "{status:?}: one cell between two surfaces");assert_eq!(right.content.x - left.content.right(), 3, "{status:?}: each surface's edge cell, then the gap");- assert_eq!(left.surface, boxed_in(Rect::new(0, 0, 59, 40), canvas, inner, status).surface);}}// ── box panes ──#[test]- fn boxes_frame_each_pane_a_cell_apart_with_the_title_in_the_frame() {+ fn boxes_touch_each_with_its_own_frame_and_the_title_in_it() {use crate::layout::{Dir, Node};let canvas = Rect::new(26, 1, 100, 40);for status in [Status::Off, Status::Top, Status::Bottom] {@@ -79,12 +85,12 @@ mod tests {match status { Status::Off => assert!(b.title.is_none()), Status::Top => assert_eq!(b.title.unwrap().y, b.surface.y), Status::Bottom => assert_eq!(b.title.unwrap().y, b.surface.bottom() - 1) }for other in &boxes[i + 1..] { assert_eq!(b.surface.intersection(other.surface).area(), 0, "{status:?}: frames never share a cell") }}- // One empty cell between side-by-side frames and between stacked ones — each pane a- // box of its own; the window's edges are the outer frames' edges.- assert_eq!(boxes[1].surface.x - boxes[0].surface.right(), 1, "{status:?}");- assert_eq!(boxes[2].surface.y - boxes[1].surface.bottom(), 1, "{status:?}");+ // Side by side and stacked, the frames touch; the window's edges are the outer+ // frames' edges.+ assert_eq!(boxes[1].surface.x, boxes[0].surface.right(), "{status:?}");+ assert_eq!(boxes[2].surface.y, boxes[1].surface.bottom(), "{status:?}");assert_eq!((boxes[0].surface.x, boxes[0].surface.y, boxes[0].surface.bottom()), (canvas.x, canvas.y, canvas.bottom()));- assert_eq!(boxes[1].surface.right(), canvas.right());+ assert_eq!((boxes[1].surface.right(), boxes[2].surface.bottom()), (canvas.right(), canvas.bottom()));}// A pane too small for a frame keeps every cell for its program.let tiny = boxed(Rect::new(30, 5, 2, 5), canvas, Status::Off);diff --git a/tui/src/settings.rs b/tui/src/settings.rsindex 547234194..67182102c 100644--- a/tui/src/settings.rs+++ b/tui/src/settings.rs@@ -100,7 +100,7 @@ pub fn chrome() -> Chrome {/// its surface lifted a little toward the text, the backdrop its surface pushed down, so the panel/// stands out in any theme, light or dark.pub fn chrome_for(pal: theme::PanePalette) -> Chrome {- let (bg, fg) = (pal.surface, pal.foreground);+ let (bg, fg) = (pal.background, pal.foreground);let light = matches!(bg, Color::Rgb(r, g, b) if 299 * r as u32 + 587 * g as u32 + 114 * b as u32 > 128_000);let floor = if light { Color::Rgb(160, 160, 160) } else { Color::Rgb(0, 0, 0) };let panel = mix(bg, fg, if light { 3 } else { 7 });@@ -115,6 +115,22 @@ pub fn chrome_for(pal: theme::PanePalette) -> Chrome {Chrome { base, muted, accent, backdrop, selected }}+/// A pane you are not in, a little quieter (`@hn-dim on`): every cell's text moved toward its+/// background — the terminal's own colours ([background], [foreground]) where it keeps them, and+/// the terminal's faint where the text is one of its indexed colours.+pub fn dim(buf: &mut Buffer, area: Rect, background: Color, foreground: Color) {+ const DIM: u16 = 35;+ for y in area.y..area.bottom() { for x in area.x..area.right() {+ let Some(c) = buf.cell_mut((x, y)) else { continue };+ let bg = if matches!(c.bg, Color::Rgb(..)) { c.bg } else { background };+ match c.fg {+ Color::Rgb(..) => c.fg = theme::depth_fit(mix(c.fg, bg, DIM)),+ Color::Reset => c.fg = theme::depth_fit(mix(foreground, bg, DIM)),+ _ => c.modifier.insert(Modifier::DIM),+ }+ } }+}+/// [a] moved [amount] % toward [b] (RGB; any other colour stays as it is).fn mix(a: Color, b: Color, amount: u16) -> Color {let (Color::Rgb(ar, ag, ab), Color::Rgb(br, bg, bb)) = (a, b) else { return a };@@ -426,6 +442,8 @@ pub struct Look {/// Where the status bar is (bottom, top, left, right), and box panes.pub bar: String,pub boxes: bool,+ /// The panes you are not in, a little quieter (`@hn-dim`).+ pub dim: bool,}impl Look {@@ -444,7 +462,8 @@ impl Look {theme,// ── status bar ──bar: match o.status_bar() { "bottom" if app.status_top => "top".into(), b => b.into() },- boxes: o.get("@hn-border", "", None).as_deref() != Some("line"),+ boxes: o.border_style() == "box",+ dim: o.dim_others(),}}@@ -462,6 +481,7 @@ impl Look {// ── status bar ──"status_bar" => self.bar = value.into(),"border_style" => self.boxes = value == "box",+ "dim" => self.dim = value == "on",_ => {}}self@@ -545,7 +565,7 @@ pub fn preview(buf: &mut Buffer, r: Rect, look: &Look, c: &Chrome) {Some(t) => (theme::pane_palette_of(t.background, t.foreground), rgb(theme::theme_accent_rgb(t))),None => (theme::native_pane_palette(), native_accent()),};- let (bg, fg) = (pal.surface, pal.foreground);+ let (bg, fg) = (pal.background, pal.foreground);let name = look.theme.map(|t| t.name).unwrap_or("your terminal's colours");let at = r.x + put(buf, r.x, r.y, r.width, "Preview · ", c.muted);put(buf, at, r.y, r.right().saturating_sub(at), name, c.base);@@ -641,6 +661,7 @@ pub fn preview(buf: &mut Buffer, r: Rect, look: &Look, c: &Chrome) {x += put(buf, x, y, inner.right().saturating_sub(x), text, s);}}+ if look.dim && !here { dim(buf, inner, pbg, pfg) }// The theme's sixteen colours, in the first pane where it has room.if let (Some(t), true) = (look.theme, here) {let y = inner.y + lines.len() as u16 + 1;@@ -671,7 +692,7 @@ pub fn preview(buf: &mut Buffer, r: Rect, look: &Look, c: &Chrome) {/// first focused, each with its repo), a rule, the machine with its window, and the separator/// facing the panes.fn preview_bar(buf: &mut Buffer, bar: Rect, left: bool, pal: &theme::PanePalette, accent: Color, names: &[&str]) {- let (bg, fg) = (pal.surface, pal.foreground);+ let (bg, fg) = (pal.background, pal.foreground);for y in bar.y..bar.bottom() { for x in bar.x..bar.right() { if let Some(cell) = buf.cell_mut((x, y)) { cell.reset(); cell.set_style(Style::default().bg(bg)); } } }let sx = if left { bar.right() - 1 } else { bar.x };for y in bar.y..bar.bottom() { buf.set_string(sx, y, "│", Style::default().fg(pal.border).bg(bg)) }diff --git a/tui/src/theme.rs b/tui/src/theme.rsindex f63bcc560..ab257458b 100644--- a/tui/src/theme.rs+++ b/tui/src/theme.rs@@ -473,6 +473,9 @@ pub fn palette() -> (Color, Color, bool) {/// Surface colors derived from the terminal theme, with a stable fallback before OSC replies.#[derive(Clone, Copy, Debug)]pub struct PanePalette {+ /// The terminal's (or theme's) own background: hn's chrome — the panel, the side bar — sits+ /// on it, as the panes do; `surface` is the focused pane's fill, lifted off it.+ pub background: Color,pub surface: Color, pub inactive_surface: Color,pub foreground: Color, pub inactive_foreground: Color, pub muted: Color,pub active_foreground: Color,@@ -514,6 +517,7 @@ fn pane_palette_for(native: Option<(Color, Color)>) -> PanePalette {let surface = mix(bg, foreground, if light { 4 } else { 10 });let surface = if surface == inactive_surface { mix(bg, foreground, if light { 2 } else { 6 }) } else { surface };PanePalette {+ background: bg,surface,inactive_surface,foreground, inactive_foreground: mix(foreground, bg, 9),@@ -581,6 +585,8 @@ pub fn fzf_change(f: impl FnOnce(&mut Fzf)) {pub fn opts_change(f: impl FnOnce(&mut FzfOpts)) {let mut c = fzf_opts().clone();f(&mut c);+ // (No list or preview in hn draws a scrollbar, whatever a list asks: see fzf_opts_base.)+ (c.scrollbar, c.preview_scrollbar) = (None, None);OPTS_LIVE.store(Box::into_raw(Box::new(c)), std::sync::atomic::Ordering::Release);}@@ -1094,6 +1100,9 @@ fn fzf_opts_base() -> &'static FzfOpts {if !sign_set { o.wrap_sign = "> ".into() }}if no_color() { o.fg = None; o.bg = None }+ // No list or preview in hn draws a scrollbar, whatever FZF_DEFAULT_OPTS says: they follow+ // the cursor, and the wheel and the keys scroll them.+ (o.scrollbar, o.preview_scrollbar) = (None, None);o})}diff --git a/tui/src/ui.rs b/tui/src/ui.rsindex 598848fda..dba660057 100644--- a/tui/src/ui.rs+++ b/tui/src/ui.rs@@ -292,6 +292,11 @@ fn window(buf: &mut Buffer, app: &mut App, body: Rect) -> Option<Position> {if let Some(pos) = pane_body(buf, pane, content, active, window) { cursor = Some(pos) }pane.dirty = false;}+ // `@hn-dim on`: a pane you are not in, a little quieter (with one pane, nothing to set apart).+ if !active && rects.len() > 1 && app.options.dim_others() {+ let pal = theme::pane_palette();+ crate::settings::dim(buf, content, window.1.unwrap_or(pal.background), window.0.unwrap_or(pal.foreground));+ }}if surfaces { pane_chrome(buf, app); } else if app.options.box_panes() { boxes(buf, app); } else { borders(buf, app, body); }if app.modal.is_some() && !matches!(app.modal, Some(Modal::Copy { .. })) { None } else { cursor }@@ -398,19 +403,16 @@ fn boxes(buf: &mut Buffer, app: &App) {let hz = box_set(&lines).4;let inner = app.box_inner(tab);let frames: Vec<(u64, crate::pane_frame::Frame)> = app.rects.iter().map(|(id, r)| (*id, crate::pane_frame::boxed_in(*r, canvas, inner, status))).filter(|(_, f)| f.content != f.surface).collect();- // The lines, each cell with the pane it is drawn for: neighbours share a line, which takes- // the colour of the one that matters most — the focused pane's, else one that waits on you.- let rank = |id: u64| if Some(id) == app.focused() { 2 } else { u8::from(app.pane_state(id) == Some(crate::fleet::State::NeedsInput)) };- let mut cells: std::collections::HashMap<(u16, u16), u64> = std::collections::HashMap::new();+ // Each box its own line, in its own colour — boxes side by side touch (`││`), never sharing a+ // line or joining at a corner.for (id, f) in &frames {- let r = f.surface;- let edge = (r.x..r.right()).flat_map(|x| [(x, r.y), (x, r.bottom() - 1)]).chain((r.y..r.bottom()).flat_map(|y| [(r.x, y), (r.right() - 1, y)]));- for p in edge { let owner = cells.entry(p).or_insert(*id); if rank(*id) > rank(*owner) { *owner = *id } }- }- for (&(x, y), &id) in &cells {- let on = |dx: i32, dy: i32| cells.contains_key(&((x as i32 + dx) as u16, (y as i32 + dy) as u16));- let g = crate::settings::joint(&lines, y > 0 && on(0, -1), on(0, 1), x > 0 && on(-1, 0), on(1, 0));- if let Some(c) = buf.cell_mut((x, y)) { c.set_symbol(g).set_style(box_style(app, id)); }+ let (r, style) = (f.surface, box_style(app, *id));+ let edge: std::collections::HashSet<(u16, u16)> = (r.x..r.right()).flat_map(|x| [(x, r.y), (x, r.bottom() - 1)]).chain((r.y..r.bottom()).flat_map(|y| [(r.x, y), (r.right() - 1, y)])).collect();+ for &(x, y) in &edge {+ let on = |dx: i32, dy: i32| edge.contains(&((x as i32 + dx) as u16, (y as i32 + dy) as u16));+ let g = crate::settings::joint(&lines, y > 0 && on(0, -1), on(0, 1), x > 0 && on(-1, 0), on(1, 0));+ if let Some(c) = buf.cell_mut((x, y)) { c.set_symbol(g).set_style(style); }+ }}for (id, f) in &frames {let (id, style) = (*id, box_style(app, *id));