# Zed A Herdr layout modeled on the Zed editor, in Tokyo Night colors. A slim title bar with breadcrumbs sits on top, a sidebar with a "New space" button, spaces and agents on the left, Zed-style flat tabs above the terminals, an optional Files/Changes panel on the right, and a status bar at the bottom with agent quota chips and the panel toggles. ![Zed](preview.png) ## What you see Top to bottom, the window is a column (`titlebar: none`, so the layout draws its own title bar): 1. **Title bar, 32px**, background `chrome` (`#1f2335`), 1px `border` line below, 12px text, draggable. Left: a sidebar toggle button (22px square, `mods/workspace-chrome/sidebar.svg`). Next to it, breadcrumbs separated by a dim `·`: the active space name (`foreground`), its git branch with a branch icon (`muted`), and the focused agent's program name, or the tab name if the tab was renamed (`muted`). Each crumb truncates at 240px. With no space it shows `Zed` in `muted`. On Windows/Linux, when the window reports buttons, minimize, maximize/restore and close sit on the right; close turns `blocked`-yellow on hover. On macOS the left padding grows to leave room for the traffic lights (`traffic_lights: [10, 8]`). 2. **Body**, a row with 1px `border` dividers: - **Sidebar, 300px** (min 44, max 560, resizable), background `chrome`, three stacked blocks: - **New space, 88px:** a 40px brand row (the Herdr logo `frame/welcome/herdr.png` at 22px with "Herdr" in semibold 14px, centered; the label hides below 160px) above a 48px row with a full-width pill button (`solid` blue `#7aa2f7`, dark text, 8px radius) with a plus icon and the label "New space". The label hides when the sidebar is narrower than 160px. - **Spaces:** the shipped `spaces` mod, weight 1, min 90px. - **Agents:** the shipped `agents` mod, weight 1, min 90px. - **Work area**, a column: - **Tab strip, 34px**, `chrome` background. Each tab is flat with a 1px right border; the active tab uses the `background` color (`#24283b`) and `foreground` text, inactive tabs use `chrome` and `muted`. A new-tab `+` button (24px, 6px margin each side) sits right after the last tab and scrolls with the tabs when there are more than fit. - **Panes**: the active tab's terminals with no gap, no radius, a 1px `border` frame, and a 1px `accent` (`#7aa2f7`) frame on the focused pane. - **Right panel, 320px** (min 220, max 640, resizable), hidden until opened, `chrome` background. A stack with two views: **Files** (project tree of the focused terminal's folder, with a Material Icon Theme icon per file and folder, open-folder variants when expanded; clicking a file opens it as a tab, see File tabs; no rounded card around it) and **Changes** (git panel: stage and commit tracked files, read-only history, the branch name, a button with ▾ that opens a 400px popup (this same mod, `props().menu`) laid out like Zed's branch picker: "Local Branches" and "Remote Branches" sections (remote-only branches), two-line rows (icon, name, then author · age · last subject; ✓ marks the current branch), and a search box at the bottom that filters and, for a new name, offers "Create branch" (`git switch -c`, also on Enter). A click runs `git switch ` (a remote-only branch gets a tracking branch); a refused switch keeps the popup open with git's message. Local branches other than the current one have a trash icon (`icons/trash.svg`, Lucide) that deletes with `git branch -D` at once, and the popup says how to restore it (`git branch `); only a branch with commits no remote has (`git rev-list --count --not --remotes`) first asks in a modal dialog (this same mod, `props().confirm`) with Cancel and Accept. Remote branches are never deleted from here. Next to the branch name sits a split button for the remote: it reads Publish (branch with no upstream), Pull ↓n (behind), Push ↑n (ahead) or Fetch, and runs that; its ▾ opens a popup like Zed's Git menu (this same mod, `props().sync`): Fetch, Fetch From…, Pull (`--no-edit`), Pull (Rebase), Push, Push To…, Force Push. Push on a branch without an upstream publishes it (`--set-upstream`); the ones with … then list the remotes (`git remote`). Force Push is `--force-with-lease` behind a confirmation modal (the delete modal, now generic: `props().confirm` with `title`, `body` and `args`). The outcome (git's first lines) is shown under the file list for 12 s as `zed-changes.result`; a failure stays in the popup. Counts come from `git rev-list --left-right --count @{upstream}...HEAD`. git runs without a terminal, so a remote that asks for a password fails with git's message; use an SSH agent or a credential helper (" · no commits yet" before the first commit, "detached" only for a detached HEAD); a folder that is the home directory, or has more than 5 000 changes, lists nothing, says so, and hides Stage All (the home case never runs `git status`), a diff view for the selected file: View Diff selects the first changed file when none is selected, and shows the diff in a 220px panel above the commit box, not at the end of the file list). 3. **Status bar, 28px**, a row on `chrome`: the shipped `workspace-status` mod (flexible), then the **agent quota bars** (400px), then two **panel toggle icons** (64px, 24px buttons with 16px Lucide icons: `folder-tree` for Files, `git-compare` for Changes). Fonts: terminal `JetBrains Mono` 14px with `[6, 8]` terminal padding; UI font `Geist`. Colors come from the custom theme `tokyo-night` (`themes/tokyo-night.json`): background `#24283b`, foreground `#c0caf5`, chrome/canvas `#1f2335`, border `#1b1e2e`, hover `#292e42`, selected `#3b4261`, muted `#565f89`, dim `#414868`, accent/solid `#7aa2f7`. ## How it behaves **Agent status** appears as an 8px dot at the left of each tab, using the theme's status colors: `working` `#7aa2f7`, `blocked` `#e0af68`, `done` `#9ece6a`, `idle` `#565f89`. A tab with no status gets the `dim` dot (`#414868`). The sidebar's spaces and agents lists show status in the shipped mods' own style. **Agent quota bars** (status bar): one slim bar per limit window reported by `quota-axi`: provider icon, window label (`5h`, `wk`), a thin bar and the percent used. Bars are quiet until it matters: amber from 60 %, orange from 80 %, red from 92 %. A tick marks how much of the window has passed. Clicking the strip opens a popup with reset times, pace ("ahead of / under pace"), the machine it reads from, a Refresh action and saved options (which limit kinds, which providers, signed-out providers, names, show remaining instead of used, Antigravity Claude/GPT limits). The layout hides `cursor` and `copilot` (`props.hidden`) and, for Grok, draws only its `credits` window (`props.windows: {"grok": ["credits"]}`) because Grok reports five weekly windows; the popup still lists all of them. Refreshes every 2 minutes; a result older than 10 minutes is marked stale. Windows of kind `unknown` (for example Codex's free-plan window) are not shown. **File tabs**: clicking a file in the Files panel opens it as a tab of its own, named after the file, with its Material icon (no agent status dot). The view is read-only (editing is left to a code editor): a thin header (icon, path with `~`, an editor icon button, a "wrap" toggle, "read only", and "truncated" for files over 400 000 characters), then the file with syntax highlighting and line numbers. The editor icon button (tooltip "Open in Zed"; local files, when an editor was found) opens the file in the chosen editor, Zed by default, falling back to the first editor found; a ▾ beside it lists only the editors installed on the machine (icon and name, in a popup styled like Herdr's menus). The "wrap" toggle (click, or Alt-Z) turns soft wrap on, off by default and per tab. Binary files show "Binary file · no text view"; unreadable files, or files over 1 MiB, show "This file is not available". It re-reads the file when its folder changes. Clicking the same file again selects its existing tab instead of opening a second one. The Files panel keeps showing the project's tree while a file tab is focused. The tab closes like any tab and survives an app restart. **Panel toggles** (status bar): clicking Files or Changes shows the right panel on that view; clicking the active one hides the panel. The active icon is `accent` blue on a `selected` background, the inactive one `ansi7`. **Tabs** - Show the agent's program icon (tinted icons follow the text color) and the tab name. Unnamed tabs (`tb`) are labeled with the program name, or `Terminal`. A zoomed tab appends ` Z`. - Click selects. Double-click renames (`tab.rename`). Press on one tab and release over another to reorder (`tab.move`). Right-click opens the shipped `menu` popup (200px wide) for that tab. - Mouse wheel over the strip switches to the previous/next tab (`tab.prev` / `tab.next`). - The active tab shows an 18px close button (`tab.close`). The `+` opens the shipped `new-menu` popup (250 x 512). **Title bar** - Sidebar button runs `layout.toggle {id: "sidebar"}`. - Window buttons run `window.minimize`, `window.maximize`, `window.close`. Dragging the empty bar moves the window. **New space dialog** (a 460 x 340 `dialog` overlay opened by the sidebar button): - Fields: Folder (prefilled with the focused pane's cwd, or the home folder; empty on a remote machine), a `Browse…` chip (hidden for remote machines, uses `pickFolder`), Agent chips (`Terminal` plus every installed agent from `knownAgents`), and an optional Branch. - `Tab` switches between Folder and Branch, `Enter` creates, `Esc` cancels. The focused field gets an `accent` border. - Create with an empty folder (local) shows `Choose a folder.` in `blocked` color and does nothing else. - No branch: runs `space.new` with `folder`, `machine` (if remote) and `argv` (the chosen agent's `run`). With a branch: opens the shipped `worktree` dialog (460 x 280) with `folder`, `machine`, `branch`, `argv`. - If agents fail to load, "Could not load agents" appears next to the chips. ## Built from `layouts/zed.json` node tree: `root` (column) → `titlebar` (block, 32px, `window_drag`), `body` (row) → [`sidebar` (column, 300px) → `new-space` (88px), `spaces`, `agents`], [`work` (column) → `tabs` (34px), `main` (block with `tab: "active"` and the `pane` style above)], [`panel` (column, 320px, `hidden: true`) → `panel-body` (stack, `active: "files"`) → `files` (zed-file-icons), `changes` (zed-changes)], then `status` (row, 28px) → `status-main` (weight 1), `status-quota` (280px), `status-panels` (64px). Layout keys: `theme: "tokyo-night"`, `font`, `font_size`, `ui_font`, `background: "background"`, `terminal_padding`, `preview: "layouts/zed.svg"`. Own mods (all `place: "none"`): - `mods/zed-title` — title bar. Reads `theme()`, `window()`, `spaces()`, `agents()`, `focused()`, `layout()`; calls `run("layout.toggle")`, `run("window.minimize" | "window.maximize" | "window.close")`. - `mods/zed-tabs` — tab strip. Reads `spaces()`, `panes()`, `theme()`; calls `run("tab.select" | "tab.rename" | "tab.move" | "tab.close" | "tab.prev" | "tab.next")`, `openOverlay({mod: "menu"})` and `openOverlay({mod: "new-menu"})`. - `mods/zed-quota` — agent quota bars: a copy of `Lakris2407/herdr-quota` (MIT) with its six open pull requests applied (#3 `percentRemaining`, #4 used/remaining toggle, #5 popup controls, #6 remote machines, #7 Windows shim, #8 Antigravity toggle). Runs `quota-axi --json` on the selected space's machine, with a login-shell fallback. Modules: `main.js`, `quota-command.js`, `quota-windows.js`, `check.svg`, tests `*.test.mjs`. Shared state keys use the `zed-quota.` prefix. - `mods/zed-settings` — the layout settings window (`mod.open {name: "zed-settings"}`, a 760×520 dialog), laid out like Zed's: a 210px `chrome` column with a search box and the categories (Editor, Quota bar, Providers), and the selected category's settings on the right, each row a label, a dim description and a switch drawn with `div`s (the base `Switch` has no styling). Searching looks through every category. Settings: word wrap for newly opened file tabs and the editor the file tabs' "open in" button uses (both in `zed-file.options`, the editor as its label, "Zed" by default; the choice is a row of chips among the installed editors, found by `editors.js`, a copy of the detection in `zed-file`) and every quota option (`zed-quota.options`). Herdr's own Settings has no extension point, so this is a separate window. The quota bar publishes its layout props as `zed-quota.start`, so the window shows the real starting options. The schema and filtering are pure, in `options.js` with tests; the quota defaults duplicate `zed-quota` (mods cannot import each other). The quota popup only shows details, with a "Settings…" row that opens it. - `mods/zed-sidebar-footer` — the sidebar footer (112px block under Agents): three 32px rows, each with a Lucide icon: **Settings** (`run("app.settings")`, with a dot when an app update is ready), **Layout settings** (`mod.open {name: "zed-settings"}`) and **Add machine** (`mod.open {name: "machine-add"}`). Same idea as the 0oz-design footer, without the account chip. Icons in `icons/` (Lucide, ISC). - `mods/zed-panel-switch` — the two toggle icons. Calls `layout.select {stack: "panel-body", child}`, `layout.show {id: "panel"}` and `layout.hide {id: "panel"}`. Icons in `icons/` (Lucide, ISC, see `icons/NOTICE.txt`). - `mods/zed-file` — the file tab view: `tab.new {name, mod: "zed-file", props: {file, icon, on}}`. Reads with `readTextFile` (≤ 1 MiB, optionally on a remote machine), shows it with `Editor`/`EditorState` (`readonly: true`), watches the file's folder with `watchFolder`. A markdown file (`.md`, `.markdown`) gets a `preview` toggle in the header (also `alt-p`) that swaps the editor for `TextView.markdown` (selectable, scrollable) drawn from the same text, so it reloads with the file; `props.preview: true` opens the tab already rendered. Editors are found once per session with `sh -c 'command -v …'` over the known launchers in `file.js` (VS Code, Cursor, Windsurf, Zed, Sublime Text, JetBrains IDEs, Kate, gedit…; terminal editors are left out), shared as `zed-file.editors`; the menu is a popup drawn by this same mod (`props().menu`), with Material Icon Theme icons for VS Code, Cursor and Sublime Text (copied to `icons/`, MIT, licence alongside), Zed's own app icon (`icons/zed.png`, the 512px icon of the installed app scaled to 128px) and a letter tile for the rest; an editor starts detached with `nohup`. Logic in `file.js` with tests. - `mods/zed-file-icons` — the Files view: a copy of `amster93/herdr-file-icons` (Apache-2.0; Material Icon Theme icons, MIT) with the root card removed. Its `open-tab.js` opens a file with `tab.new`/`tab.select` and records tab → `{file, icon}` in shared key `zed-file.tabs`, which `zed-tabs` reads for the tab icon (mods cannot import each other, so the icon path travels in the tab's props). Lists folders with `sh` (`powershell` on Windows), runs `git` for change marks, watches the folder with `watchFolder`. Right-click on a row opens a 220px popup (this same mod, `props().fileMenu`): Copy Path, Copy Relative Path and Delete; Delete asks in a confirm dialog (`props().confirm`) and then runs `rm -rf --` (`Remove-Item -Recurse -Force` on Windows) on that one path, which is permanent; the dialog publishes `zed-file-icons.changed` so the panel reloads (a remote folder has no watcher). The menu and the path guard are pure, in `menu.js` with tests. 1184 SVGs in `icons/` indexed by `icons.js`. Credits in the README. - `mods/zed-diff` — the diff tab view: reads `git diff HEAD -U10` (or the whole file for an untracked one) with `exec`/`readTextFile`, parses it with `diff.js` and draws one row per line (old/new line numbers, green/red tint, `+`/`-`, tokenized syntax colors from the theme's `ansi` colors). Read-only, up to 4000 rows, reloads on folder changes. - `mods/zed-changes` — the Changes view; it runs `git` (status, diff, add, commit) in the focused terminal's folder, with tests for its planning logic. Clicking a changed file opens `tab.new {name, mod: "zed-diff", props: {root, path, xy, on}}`. Right-click on a changed file opens a 260px popup (this same mod): Stage/Unstage File, Discard Changes (a confirm dialog; `git restore --source=HEAD --staged --worktree`, or `git clean -f` for a new file), Copy Path / Copy Relative Path (`cx.write_to_clipboard`), Add to .gitignore / Add to .git/info/exclude (enabled for untracked files; appends an anchored line once), Open Diff and View File (a `zed-file` tab, disabled for deleted files). - `mods/zed-new-space` — one mod, two roles: without `props().overlay` it renders the sidebar button; with it, the dialog. Uses `InputState`/`Input` from `gpui-base`, `knownAgents`, `pickFolder`, `home`, `panes`, `spaces`, `layout`, `openOverlay`, `closeOverlay`. Pure logic lives in `plan.js` (`planNewSpace`, `startingFolder`) with tests in `plan.test.js`. Its `mod.json` has `overlay: {width: 460, height: 340}`. Shipped mods used: `spaces`, `agents`, `workspace-status`, `menu`, `new-menu`, `worktree`. Shipped assets used by path: `mods/workspace-chrome/{sidebar,branch,plus}.svg`, `mods/tabs/win-{min,max,restore,close}.svg`, `mods/pane/close.svg`. Programs run: `git` (zed-changes, zed-file-icons), `sh`/`powershell` (zed-file-icons folder listing), `rm`/`powershell` (zed-file-icons delete) and `quota-axi` (zed-quota; also through the user's login shell as a fallback). `quota-axi` contacts each provider's usage endpoint with the credentials already stored on the machine. No `hc`. File access: the folder picker, the folders the user browses in the panel, and whatever `quota-axi` reads for its providers. Art: `layouts/zed.svg` is the layout's picker preview; `preview.png` is the screenshot for herdr.dev. ## Watch out - Each mod ships its own `gpui-kit.d.ts` and `jsconfig.json` for editor typing. They are editor-only helpers and are optional for a fresh build. - The theme `tokyo-night` is a custom file, not a shipped one. Without `themes/tokyo-night.json` the layout falls back to a different palette and the status dots lose their intended colors. - `zed-title` assumes `traffic_lights` in the layout (`[10, 8]`) for macOS padding, and that window buttons only render when `window().buttons` is true. - The close-button hover reuses the `blocked` color (yellow) as the danger color; there is no red in the title bar by design. - Sidebar mods (`spaces`, `agents`) switch to a compact rail under 160px, and `zed-new-space` hides its label at the same threshold by reading the `sidebar` node's `size.px` from `layout()`. Toggling or resizing the sidebar through other means that don't change `size.px` won't hide the label. - The branch field always hands off to the shipped `worktree` dialog; this layout never creates a checkout itself. - The `−` / `□` / `❐` glyphs are used for the minimize/maximize/restore buttons on macOS and Linux; only Windows uses the shipped `win-*.svg` icons. - Herdr does not serve SVG/PNG assets through symlinks, refuses `import` of modules that resolve outside its folder, and caches a failed load per path. Copy mods as real files (the repo's `install.sh` does) and use a new file name if an icon silently fails to appear. - The quota bars need [`quota-axi`](https://github.com/kunchenguid/quota-axi) on the machine (`npm install -g quota-axi`; check with `quota-axi --json`). Newer versions report `percentRemaining`, not `percentUsed`; derive used as `100 - remaining`, never for a `shareOf` window. - Too many bars overflow the 400px block and clip the left side. Keep `hidden` and `windows` in the block's `props` (or the popup's options) tight. `windows` is a local addition: a per-provider allowlist of window ids for the strip only, ignored when empty or when nothing matches. Codex's free-plan window is kind `unknown`, so it shows only its icon. - It does not define `keys.json`; the title-bar toggle has no dedicated shortcut beyond the app's own `ctrl-shift-b`. ## Done when - `herdr-app check` passes for every folder in `mods/`. - `herdr-app do layout.switch '{"name":"zed"}'` shows the window described above, and `layout.error` is absent. - The title bar shows `space · branch · agent` for the active space, and the sidebar button collapses and restores the sidebar. - The tab strip shows one flat tab per tab of the active space, with a colored status dot; double-click renames, drag reorders, right-click opens the menu, wheel switches tabs. - Clicking "New space" opens the dialog with the folder prefilled; Create with a folder runs `space.new`; Create with a branch opens the `worktree` dialog; an empty folder shows `Choose a folder.`. - Clicking Files or Changes in the status bar opens the right panel on that view and clicking the active one closes it; the icons are visible against the bar. - With `quota-axi` installed, the status bar shows a Claude `5h` and `wk` bar matching `quota-axi --json` (used = 100 - percentRemaining), and clicking it opens the popup. - `node --test` passes for `mods/zed-new-space/plan.test.js`, `node --test mods/zed-quota/*.test.mjs`, `mods/zed-changes/plan.test.js` and `mods/zed-file-icons/*.test.js`.