# Quick Close Keep Herdr's familiar tab bar and Agents panel, but make closing work possible in either place. Middle-click any top tab or main agent row to close its tab. Put a small × at the right of each main agent row so the person can close work directly from the panel they use to navigate it. This is one customization delivered as two independently usable panel mods. ![Quick Close](preview.png) ## What you see - Across the top, the standard tab bar: a horizontal, scrollable row of 29px-high pills with 10px horizontal padding, 7px gaps inside each pill, 7px corners and 12.8px text. Each pill shows its program icon, truncated tab name and status. The active tab keeps its existing ×. A + menu, enabled Files/Changes controls and platform window controls sit at the right. Use the surrounding layout's existing tab-block height; the standard Herdr layout uses 42px. - At the lower left, the standard Agents panel, with an Agents heading and sort control, a scrolling list and its existing footer. The heading is 41px high. Main rows are 30px high with 8px corners, 8px horizontal padding, 9px gaps and 13px text. Show the program icon, space/tab detail, optional remote machine, child-fold control, elapsed time or hover pin, status and a new × at the far right. Its hit target is 18px square with a 12px icon. - The panel switches to a compact rail when the sidebar is narrower than 160px. Main rows are 26px high; show their navigation number and status. On hover, replace the status slot with a 14px-square close target and a 10px ×. - Follow the current theme throughout: chrome for bars, foreground/muted/dim for text, hover for pointer feedback, selected for the focused agent, raised for the active tab and border for outlines. Use the current working, blocked, done and idle colors rather than fixed colors. ## How it behaves - A middle-button press anywhere on a top tab pill closes that exact tab, even if it is inactive. Clear any pending left-button reorder state and stop propagation. Do not select the tab first. - A middle-button press on a main agent row closes that row's tab, even if another space or tab is selected. It works in the full panel and compact rail. Stop propagation. - Left-clicking a row's × does the same thing. The tooltip says “Close tab and its terminals”. Stop both its left press and its click from reaching the row so the button does not also focus the agent. Keep the × visible in full rows; show it on hover in compact rows. - Closing means closing the entire tab and its terminals, using Herdr's normal confirmation behavior. Do not bypass confirmations. Closing the last tab can close its space. Nested sub-agent rows keep their existing peek behavior and gain no close control or middle-click handler. - Preserve the original interactions: left-click to select a top tab or focus an agent, double-click a tab to rename, the existing press/release tab reordering, right-click tab menus, tab navigation by wheel, + menus, panel controls, pinning, group and child folding, sorting, sidebar collapse and native window controls. No new keyboard bindings. - Working status uses the shipped spinner with a native 900ms rotation. Blocked and done top tabs show colored dots; idle top tabs have no extra status mark. In Agents, blocked shows “Needs you” or a compact ! where its section already supplies the label, done shows a dot, idle a ring, and working a spinner. A viewed done agent stays in its Done group until focus leaves. Parent rows inherit their most urgent child for priority ordering. - Preserve Priority and Grouped by space views, pinned rows first, elapsed status age, live data updates and theme changes. Agent navigation follows the displayed main-row order. Preserve per-space side-panel choices and existing per-mod pins/state persistence. ## Built from Read the installed `~/.config/herdr-app/AGENTS.md`, `herdr.d.ts` and `gpui-kit.d.ts` first. Starting with an empty destination, duplicate the installed shipped `tabs` and `agents` mods into `mods/middle-click-tabs/` and `mods/agent-close-buttons/`. Their originals are the reference for the retained behavior; adapt to the installed version instead of guessing its API. This build is based on Herdr 0.1.9. Each folder contains `main.js` default-exporting a `View`, and `mod.json` with `place: "none"`, a descriptive title and `cloned_from` provenance. In the tabs copy, add an `on_mouse_down("middle", ...)` handler to each pill. In the agents copy, create a row-local `closeTab` callback shared by the × click and both expanded/compact middle-button handlers. In each case call `cx.stop_propagation()` and `run("tab.close", { id: ... })`, targeting the pill's `c.id` or the row's `a.tab`. Do not substitute the currently focused tab. There is no layout tree to distribute. For installation only, duplicate the person's shipped layout if necessary and replace the two appropriate `content.mod` references in their personal layout. Standard block roles are `sidebar`, the `tabs` block above the active-tab area, and the `agents` block in the sidebar. The tab bar's existing Files/Changes support expects `panel` and `panel-body`, with children named `files` and `changes`. Preserve those IDs and other layout choices. The tab bar reads `spaces`, `panes`, `theme`, `window`, `shared`, `layout` and `settings`. It uses `run` for tab close/select/rename/move/next/prev, layout select/show/hide and window minimize/maximize/close, and `openOverlay` for the shipped `menu` and `new-menu`. Keep its per-space panel state in `localStorage`. The Agents copy reads `agents`, `terminals`, `panes`, `focused`, `spaces`, `theme`, `shared`, `window` and `layout`; it uses `setShared`, `setAgentOrder`, `run`, `openOverlay`, `closeOverlay` and `props`. Retained commands include `pane.focus`, `terminal.peek`, `layout.resize` and `tab.close`. Its only overlay role is `props().sortMenu`; point that popup to `agent-close-buttons` itself and close it using `props().overlay`. Keep its 30-second age refresh and per-mod state for pins and status-change times. Use the callback's own context, never a saved one. Use the installed native `gpui-kit` and `gpui-base` builders. Reuse Herdr's shipped assets: `mods/pane/close.svg`, the spinner and control icons under `mods/workspace-chrome/`, Files/Changes icons and the app's program icon table. Do not copy unrelated shipped mods or embed personal state. Neither mod runs external programs, reads project files or accesses the network; image assets come from the installed app home. No keys snippet is needed. ## Watch out - These are native GPUI scripts, not DOM/HTML widgets. Middle mouse is the string `"middle"`; left and middle handlers can coexist. A middle press closes immediately, before release. - Always close the clicked row's tab. Agents in other spaces, inactive tabs and several agents sharing one tab make focus-based targeting incorrect. Sharing a tab means its other panes close too. - Main-row close handling intentionally excludes nested child rows. Do not kill a sub-agent independently or silently broaden the feature. - Put propagation stops on the close control; otherwise a click may reach the row's focus action. Middle-click must not invoke rename, pin, fold, drag or focus actions. - The compact rail has little room. Replace its status slot on hover rather than adding another column. Keep labels truncating and the close target from shrinking in normal rows. - Update the agents copy's self-opening sort-menu mod name when cloning or renaming. Other asset paths continue to refer to Herdr's shipped mods and must stay valid. - Shipped mods are overwritten on startup. Personal clones persist but can lag future upstream behavior; the recorded base is 0.1.9, not a promise about every future version. Custom layouts with different block IDs or assets need adaptation. - Package only the two source folders, this recipe, the screenshot and documentation/license files. Do not ship a `layouts/` folder, app state, generated declarations, check logs, credentials, private paths or terminal transcripts. ## Done when - `herdr-app check` passes for both packaged mod folders, the integrated window renders, and `herdr-app status` reports no errors. - With disposable tabs, middle-click an inactive top pill while another tab is selected: only the clicked tab closes. Repeat on an active tab. - In Agents, middle-click a main row from a different tab or space: its tab closes. Repeat using × and verify the row does not also focus. Keep ordinary confirmation dialogs intact. - Collapse the sidebar: middle-click still closes the right tab; hovering reveals a working × without widening the rail. Expand it again. - Verify normal selection, tab renaming/reordering, status indicators, agent sorting and pinning, group/child folding, child peek and the Files/Changes controls still work. - Capture a real window screenshot as `preview.png` using sample content. The public package contains both mods and no layout or key-binding files. Publish it in a public GitHub repository with topic `herdr-mod`.