# herdr-omp-auto-tabs [Herdr](https://herdr.dev) tab bar whose tabs name themselves, for [omp](https://github.com/oh-my-pi/pi-coding-agent) users. An omp tab takes the title omp gives its session. A terminal tab shows the program running in it, or its folder when the shell is at the prompt. Tab names can be up to 280px wide before they are cut off with "…". If you rename a tab yourself, the mod leaves it alone. Derived from [longwave/herdr-auto-tabs](https://github.com/longwave/herdr-auto-tabs), the Claude Code version — same recipe, adapted for omp. ## What you see Identical to Herdr's own tab bar: tabs for the active space in a row that scrolls sideways, a **+** button, **Files** and **Changes** buttons, and window buttons when `window().buttons` is set. Same colours, same sizes, same drag-to-move, double-click-to-rename, right-click menu. Only the names change. ### Tab names The mod checks every tab every 3 seconds and names it from one pane: the tab's agent pane if it has one, otherwise its first terminal pane. | Pane | Name | Example | |---|---|---| | omp | its terminal title, cleaned (see below) | Build herdr auto tabs for omp | | Shell running a program | the program's display name | Python, Neovim | | Shell at the prompt | the last part of its folder; `~` in the home folder | my-app | omp sets its terminal title itself (OSC 0), so there is nothing to install on the omp side. The title carries state in its wrapper, which the mod strips: - the leading `π` brand; - the state separator — `>` (idle), `!` (needs you), `:` (title state off) or the working spinner frame (braille, moon-phase or line style); - the Nerd Fonts glyph omp heads generated titles with (private-use-area characters the UI font can't draw); - the category code on generated titles (`: ` → ``). What remains is omp's session title, or the folder name until omp has generated one. ## How it behaves - **Agent status** on each tab, using the most urgent status of the agents in it (working spinner, blocked dot, done dot). omp reports these through Herdr's own integration (`herdr integration install omp`), not through this mod. - **Click** a tab to select it. **Double-click** to rename it. **Right-click** opens Herdr's `menu` mod. - **Drag** a tab onto another to move it. **Scroll** over the bar for previous/next tab. - **Renaming:** a tab is renamed only when it has no name yet, still has its agent's default name, or still has the name the mod last gave it. Once you rename it, it keeps your name. Renaming it to "" (its number) or the agent's default name hands it back to the mod. ## Install Copy `mods/auto-tabs/` into your Herdr home (`~/.config/herdr-app/mods/`), then clone a shipped layout — Herdr's own layouts are read-only and restored on every start: ```sh herdr-app do layout.clone '{"name":"main","as":"my-main"}' ``` In the clone's JSON (`~/.config/herdr-app/layouts/my-main.json`), set the `tabs` block to `"content": { "mod": "auto-tabs" }`. In any other layout, give it a block about 42px high. Then reload: ```sh herdr-app do layout.switch '{"name":"terminals"}' herdr-app do layout.switch '{"name":"my-main"}' ``` ## Built from - `mods/auto-tabs/main.js`: a clone of Herdr's shipped `tabs` mod with two changes. The name's `max_w` goes from 170 to 280, and `init(_props, cx)` starts `cx.timer.every(3000, () => syncNames())`. - `mods/auto-tabs/names.js`: `syncNames()`. - Reads `spaces()` (each tab's `id`, `name`, `named`) and `panes()` (`tab`, `terminal`, `title`, `cwd`, `program.shell`, `program.name`, `program.agent`). - Calls `run("tab.rename", {id, name})`. - Remembers the names it gave in `shared("tab-titles.set")`, a map of tab id to name. It drops tabs that no longer exist and writes with `setShared` only when the map changes. - `mods/auto-tabs/mod.json`: `{ "place": "none", "title": "Auto tabs" }`. - It runs no programs, reads no files and makes no network requests. - No keys. ## Watch out - **Placement.** It replaces the tab bar, so `place` is `none`. See Install above. - **A fresh copy needs a reload.** Herdr only notices a new mod folder when the layout loads it; `layout.switch` away and back, or restart Herdr. Later edits hot-reload on save. - **`herdr-app check` runs without live data:** `panes()` and `spaces()` are empty, so it proves the mod loads, not that it names anything. - **`tab.rename` sets `named`**, so after the first rename the mod can't use `named` alone to tell its own names from yours. That is why it stores the names it gave. - **Program names only.** `panes()` gives the program's display name but not its command line, so `python3 crawl.py` shows as "Python". - **omp's early title.** Until omp generates a session title, its title label is the folder name, so a new omp tab may show that briefly. - **Home folders** are found by the pattern `/Users/`, `/home/` or `/root`. A machine with another home path shows its folder name instead of `~`. - **Agent tabs name themselves after the agent's title.** A tab running omp *and* a plain terminal takes omp's name; the agent pane wins. - **Other agents pass through raw.** A Claude Code tab keeps Claude's title as-is, spinner glyph included; the cleaning above is omp-only. - **Runs only while the bar is in the layout.** If a layout shows the bar twice, both copies rename tabs; the second finds nothing left to do. ## Done when - `herdr-app check mods/auto-tabs` passes. - The tab bar looks and behaves like Herdr's own, except that a long name runs to 280px before "…". - Within 3 seconds of an omp session getting a title, its tab shows that title. - A new terminal tab in `~/projects/my-app` is named "my-app"; running `python3` in it changes the name to "Python", and exiting changes it back. - A tab you rename by double-clicking keeps your name while its title changes. - Renaming that tab to "" hands it back to the mod within 3 seconds. - `shared("tab-titles.set")` lists only tabs that still exist.