# Auto tabs A compact Herdr tab bar with wider session names, automatic OMP and Claude Code titles, and a persistent manual-name override for OMP tabs. Tabs, status marks, a new-tab menu, and optional workspace-panel controls share one horizontal strip. The same mod can render terminal pane headers that follow each pane's own session title. This is a mod for an existing window, not a replacement layout. ![Auto tabs](preview.png) ## What you see - Use a 42px-high tab-bar slot. The bar fills its slot, has 10px horizontal padding, a 3px gap, a 1px bottom border, and theme `chrome` background. Nothing has a fixed light/dark color. - On the left, horizontally scrollable tab pills show the active space's tabs in their existing order. Each pill is 29px high, with 10px side padding, 7px gaps, 7px corner radius, a 1px border, and 12.8px text. Active tabs use `raised` background, `border` outline, and `foreground` text; inactive tabs use `chrome` and `muted`. Hover uses `hover` background. - Each pill contains a 14px program icon when available and a title truncated at 280px. A legacy name shaped like `tb123` displays the program's name instead. A zoomed tab appends ` Z`. Only the active tab has a 12px close icon. - Status marks follow the title: a 12px native rotating ring for working, a 6px dot for blocked or done, and no mark for idle. Each uses the corresponding theme status color. - A 26px square `+` button follows the scrolling tabs. Optional 26px-high Files, Changes, and Git buttons sit to its right; their selected panel uses the theme's `selected` color. Native window controls appear at the far right only when Herdr says this layout must draw them. - On macOS with custom title bars, reserve room for the traffic lights using the layout's `traffic_lights`, `sidebar` width/visibility, current zoom, and fullscreen state. Do not overlay them with tabs. - When mounted as a terminal pane header, keep Herdr's program icon, folder, status, focus-on-click, and hover split/zoom/close buttons. OMP and Claude headers display that terminal's cleaned live session title instead of the generic program name; long titles truncate at 260px and show the full title on hover. Before a meaningful title exists, fall back to the existing program/title/shell label. ## How it behaves - Clicking a tab selects it. Double-clicking opens Herdr's rename dialog. Right-clicking opens the shipped tab context menu for that exact tab and space, not whichever tab happens to be focused later. - Pressing on one tab and releasing on another moves the pressed tab to the target position. The strip scrolls horizontally; a vertical wheel delta of at least one switches to the previous or next tab. The close icon closes only its own tab and does not select or drag another tab. - `+` opens the shipped new-tab menu. Window buttons minimize, maximize, or close the window. Hover highlights interactive elements. - A working tab spins its ring with native animation, not redraw timers. Blocked and done tabs show their colored dots. Idle tabs have no extra mark. Herdr owns status aggregation and acknowledgement; this mod displays the status it supplies. - For naming, inspect terminal panes in every space, not just the visible space. Ignore mod panes. Choose the first OMP pane in a split tab; otherwise the first Claude Code pane; otherwise the first terminal pane. This choice does not follow keyboard focus. - OMP must report its application as `omp`. Follow its terminal title, stripping only a leading `π`, the optional following Braille spinner, and prefix whitespace. Preserve emoji and the rest of the title. Empty/indicator-only titles leave the name unchanged. - Initially follow an unnamed OMP tab, an automatically owned tab, a tab already matching its OMP title, or a launcher-default name (`omp`, `OMP`, `Oh My Pi`). Preserve other existing custom names. - Once managing an OMP tab, compare its actual name with the last name assigned by the mod before considering the next title. An external rename or reset to an unnamed tab opts that tab out. Persist that opt-out: returning the name to `omp`, changing the session title, or reloading the mod must not resume following. Closing the tab removes its saved ownership. A rename that leaves exactly the same name and named state is not observable through the available snapshots. - Preserve the existing non-OMP naming: Claude Code titles lose leading non-letter/non-number decoration and surrounding whitespace; other programs use their display name; shell prompts use the final folder component. Do not overwrite custom non-OMP names. - Pane titles are independent of tab-name ownership. A manually renamed tab stays manual while its terminal header keeps following the live session. Split panes read their own `props().pane`, never the tab's lead terminal or whichever pane has keyboard focus. Preserve shell and other program header labels. - Panel buttons toggle the matching optional panel. Remember the selected panel, or closed state, per space. Switching spaces restores that space's selection. During an asynchronous restore, allow up to one second before recording a competing observed state. - Keyboard bindings are ordinary Herdr commands, not a private mod command loop. The optional `keys.json` snippet supplies F2 rename, Ctrl-Tab / Ctrl-Shift-Tab navigation, and macOS Cmd-T / Cmd-W new/close. Existing bindings can be retained instead; merge the snippet without replacing a person's keys silently. ## Built from Create these files in an empty package folder: ```text RECIPE.md preview.png keys.json mods/auto-tabs/main.js mods/auto-tabs/names.js mods/auto-tabs/pane.js NOTICE LICENSE-APACHE mods/auto-tabs/mod.json mods/auto-tabs/icons/graph.svg ``` Do not include `layouts/`, user state, generated type declarations, or generated editor configuration. - `main.js` default-exports a `View` from `gpui-kit`. Build the bar with `div`, `svg`, `image`, and `h_flex` from `gpui-base`. Without a pane prop, initialize pressed-tab state and per-space panel choices, and call the naming helper from `render()` so live Herdr changes drive updates. With the app-supplied `pane` prop, initialize header hover state and render `pane.js` instead, without tab naming or panel side effects. Do not poll terminal state or run shell commands. - `names.js` owns title selection and name ownership. Use `spaces()`, `panes()`, `shared()`, `setShared()`, and `run()`. Keep `tab-titles.set` as tab-id to last automatic name, and `tab-titles.omp` as tab-id to following (`true`) or manually opted out (`false`). Only persist changed maps. Return without mutation when there are no spaces, including the mod checker. Remove entries for tabs no longer present. - Use the OMP prefix expression `/^π(?:\s+[\u2800-\u28ff])?\s*/`. Check manual ownership before applying a new title. Claim an initially unnamed tab with an explicit rename even if its numeric position already equals the title, so the next update does not mistake it for a manual reset. - `pane.js` adapts the shipped pane header and imports the pure `paneTitle(pane)` helper from `names.js`. The helper reuses OMP/Claude prefix cleanup without touching tab naming or shared state. Preserve the original header's controls, theme, folder shortening, and status display. - `main.js` also reads `theme()`, `window()`, `settings()`, `layout()`, and `shared("workspace.panels")`. Store per-space panel choices in per-copy `localStorage` under `panels`. - Commands are `tab.select`, `tab.rename`, `tab.move`, `tab.close`, `tab.prev`, `tab.next`, `layout.select`, `layout.show`, `layout.hide`, and `window.minimize` / `window.maximize` / `window.close`. Menus use `openOverlay()` with the shipped `menu` and `new-menu` mods. The tab menu receives `{tab: "tab", target: {id, space}}`; the new-tab menu is 250px by 512px, the tab popup is 200px wide. - `mod.json` has `place: "none"`, title `Auto tabs`, and records its original clone from shipped `tabs` version `0.1.9`. There are no required tab-bar props and no automatic layout installation. The header role uses the `pane`/`terminal` props supplied by Herdr's pane frame. - Fit it into the person's existing personal layout by replacing that layout's tab-bar block content with `{ "mod": "auto-tabs" }`, normally keeping a 42px height. To enable live terminal headers, also set the active tab frame's `pane.header.content` to `{ "mod": "auto-tabs" }`, retaining its existing height/reveal/position and all other frame settings. No layout file is distributed. Never edit a shipped layout directly: clone it first if needed, and preserve unrelated layout choices. - Optional panel integration expects a container node `panel` and a stack `panel-body`; stack descendants `files`, `changes`, and `graph` are the selectable targets. Offer Files and Changes only when enabled in `workspace.panels` (default: both) and the matching target exists. Offer Git only when the `graph` target exists. A bar without this panel structure still works and hides those buttons. The `graph` panel's implementation is supplied by the host layout; a separate Git graph mod is not bundled or required for tabs and title sync. - Shipped art is referenced at `mods/workspace-chrome/spinner.svg`, `mods/pane/close.svg`, `mods/files/file.svg`, and `mods/changes/changes.svg`, plus program icons from Herdr. Bundle the small 24-by-24, current-color branching graph SVG inside this mod at `icons/graph.svg`; do not reference another personal mod's icon. - Header button assets additionally use the shipped `mods/pane/split-right.svg`, `split-down.svg`, `zoom.svg`, `unzoom.svg`, and `close.svg`. The header is adapted from Herdr's Apache-2.0 pane mod; retain `NOTICE` and `LICENSE-APACHE` with the package. - The mod itself makes no network requests, launches no programs, uses no `exec` or `hc`, and reads no external files. It reads Herdr's live model and persists mod state. User actions can open shipped menus that launch programs or close terminals through Herdr's normal commands. ## Watch out - Read the installed `AGENTS.md`, `herdr.d.ts`, and relevant `gpui-kit.d.ts` sections when rebuilding. These generated APIs, not browser/Node APIs, are the contract. There is no DOM, `setTimeout`, or `setInterval`; do not add an OMP skill, daemon, or watcher. - The mod is active while mounted in the chosen layout. It is not installed into every layout automatically. Live rendering can be suspended while the window is not drawing; names reconcile when the view renders again. Do not claim a headless background synchronization service. - Keep the manual OMP opt-out in shared persistent state rather than a class field. Spinner-only changes must not cause tab renames. Existing custom tab names must not be treated as launcher defaults. - Per-tab naming and opt-out state are shared across mod copies; panel choices are per-copy storage. Simultaneous clients use Herdr's last-accepted layout writes, not a custom distributed lock. - The shell-home shortcut currently recognizes `/home/` and `/root`; it does not infer macOS home directories, Windows drive paths, or arbitrary remote home folders. Preserve this limit unless intentionally extending the recipe. - Never store a callback's `cx` for later use. Stop propagation on close and button interactions. Use native `.spin(900)` for the status ring. - Shipped menus and art come from Herdr. Install under a different mod name if `auto-tabs` already belongs to someone else, and rewrite its own `mods/auto-tabs/` asset references. Never copy a person's keys, shared state, terminal addresses, or layout into this public package. - The preview is a crop of the actual bar with example OMP sessions; it deliberately excludes terminal contents and the rest of the person's workspace. ## Done when 1. `herdr-app check /mods/auto-tabs` passes; mounting it in an existing personal tab-bar slot produces no errors in `herdr-app status`. Checking an empty model must not clear saved title ownership. 2. The visible bar renders the active space's tabs, truncates long titles, scrolls, selects, reorders, renames, and closes the targeted tab. The new-tab and context menus open with the intended target. Working, blocked, done, and idle display their documented marks. 3. An OMP title changes from A to B and its eligible tab follows automatically. Emoji survives; changing only the Braille spinner does not rename the tab; an empty title does not erase it. 4. Rename an automatically managed OMP tab manually, then change its OMP title. The manual name remains. Reload the mod, rename the tab back to `omp`, and change the title again: it must remain opted out. Existing custom names also remain untouched. 5. In a split tab, OMP wins over Claude and the first OMP pane remains the title source regardless of focus. Existing Claude and shell/program naming continue to work. 6. A layout without optional panel targets shows no dead panel buttons. With the expected panel nodes present, available buttons toggle the matching panel and panel choices restore when switching spaces. 7. With live headers enabled, changing an OMP session title changes that pane's header. A manually named tab remains unchanged, while the header continues following the session. Two split terminals with different session titles show different headers, regardless of keyboard focus. Focus and split/zoom/close controls still target their own pane. 8. The public package has the listed source files, optional key snippet, this recipe, and an actual `preview.png`; it contains no `layouts/` directory, private state, generated editor files, or external personal-mod asset references. Its public GitHub repository has topic `herdr-mod`.