# Space folders Herdr's grouped Spaces sidebar with one extra right-click action: **Open in Finder** on macOS or **Open in Explorer** on Windows. It opens the clicked space's current folder without switching to that space. Nested groups, machine sections, and worktree rows remain familiar. This is a complete sidebar mod for the person's existing window, not a replacement layout or an Agents panel. ![Space folders](preview.png) ## What you see - The Spaces sidebar fills its existing block, using the theme's chrome background and 13px base text. Its 31px header has an 11.5px dim Spaces label and a 26px plus button. The list below scrolls, with 8px side padding and 14px bottom padding. - Root space rows are 30px high, worktree rows 28px. A space has an 18px colored initial avatar, its name truncated at 150px, and inherited repository/branch/ahead/behind hints when relevant. The selected space has the selected background; other rows gain hover background. - Machine sections appear when another machine is known: this computer first, then named machines, with connection indicators and a New space there row when empty. Temporary core machines are excluded. - Within a machine, groups precede ungrouped spaces. A group header is 26px high, with 8px side padding, a 13px folder icon, 12px muted name, 11px chevron, and 7px rounded corners. Child groups and member spaces indent a further 12px per level. Folding hides the entire subtree; a folded ancestor of the shown space gets the selected background. - Right-clicking a space opens a themed popup, 200px wide and at most 391px high. It has 5px padding, 12.8px text, 31px rows, 8px row side padding, 9px gap, 7px rounded row corners, and 14px muted icons. Existing key hints sit at the right in 11px dim text. Group-move and close sections have 1px borders with 4px vertical margins. - Space menu order: Rename; **Open in Finder** or **Open in Explorer**, with the existing folder icon; items registered by other mods; applicable New/Open/Remove worktree actions; Move to group and, when grouped, Remove from group; Close. Nested worktree rows omit group actions because they move with their checkout. - The new opener is dimmed and inert when its space is remote or has no usable folder. Clients other than macOS and Windows omit it. Group headers keep their group menu; a virtual group does not gain a file-manager action. - Below 160px sidebar width, preserve the inherited compact numbered rail and folder-group indicators instead of expanding the popup UI into a new panel. Space file-manager actions are on expanded space rows, not compact rail rows. ## How it behaves - Left-click a space to show it. Right-click does not select it: opening a folder must not change which space or terminal is active in Herdr. - Open the first terminal pane's live directory belonging to the clicked space's tabs; use the space's starting folder only if none has a live directory. A focused terminal belonging to some other space must never override this target. - A successful file-manager launch closes the popup after the launch has finished. Keep the popup alive while the async action runs. A missing program, rejected process launch, or nonzero result shows a Could not open folder error notification, then closes the popup. Do not silently ignore launch failures. - Up/Down move the context-menu selection, Enter activates the selected enabled item, Escape dismisses it, and clicking an enabled row performs the same action. A disabled item does nothing. There are no new global key bindings. - Existing menus remain functional: Rename and Close target the clicked space, worktree actions open the inherited dialogs, and registered extension items receive that space's identity. - Click a group to fold/unfold it. Switching to a space inside a folded group, by any Herdr navigation route, unfolds its ancestors. Folding the currently shown space's group stays folded until navigation arrives there again. - Keep group context actions: Rename group, Add Sub Group, Move to group, Move up/down among siblings, Delete group. Deletion moves children and members up one level, not to oblivion. Empty/duplicate names disable Save/Create. - Move to group opens a 380px dialog with a 36px Group input and 32px choices, filtered by text and named by their full group paths. It can create a new group from the typed name. A nested group's move dialog offers Top level and excludes itself and its descendants. Arrow keys, Enter, click, and Escape keep their inherited behavior. - Drag a space onto a compatible row to reorder it and join that row's group; dropping on a group joins it. Drag a group onto another's top/bottom quarter to reorder siblings, or middle to nest it. Highlight the target/landing line. Cross-machine group moves and cycles are forbidden. Worktree children only reorder within their inherited grouping rules. - Retain working, blocked, done, and idle statuses supplied by Herdr; do not synthesize task states. The expanded sidebar concentrates on space and Git information, not duplicate agent rows. In the compact rail, blocked/done use a filled dot, working/idle a middle dot, colored by the corresponding theme status color. - Group-aware Agents mods may read the compatible shared group data, but this package neither requires them nor adds an Agents sort menu of its own. ## Built from ### Package ```text RECIPE.md README.md preview.png NOTICE LICENSE LICENSE-APACHE LICENSE-LUCIDE mods/space-folders/ main.js sidebar.js groups.js menu.js dialogs.js mod.json arrow-up.svg arrow-down.svg ``` The files are one implementation of this brief. Rebuild them in an empty folder using the installed Herdr types and the contracts here; do not depend on the author's configuration, copied shared data, a particular layout name, or another mod's code files. - `main.js` default-exports a GPUI View. With ordinary props it delegates to Sidebar; `props.role` selects Menu, MoveDialog, or NameDialog for `menu`, `move`, and `name`. Delegate both initialization and rendering with each current callback context. - `mod.json` is `{ "place": "none", "title": "Space folders" }`. The mod is used as the existing Spaces block's content and opens overlays of itself. Do not dock an extra sidebar automatically. - `groups.js` exports `MOD = "space-folders"` for overlay and bundled-icon addresses, but retains the independent shared-state key `space-groups`. Data is `{ groups: [{ id, name, machine, folded, parent }], spaces: { : } }`. Local machine is null. Missing, cyclic, or cross-machine parents normalize to null. Keep sibling order; reject nesting into descendants. Prune missing space memberships only once that machine's layout is ready, never while loading/offline. - Preserve the separate shared `space-groups.menu` extension point: `{ : [{ label, icon?, spaces?, except?, overlay }] }`. Space filters apply before rendering; append the clicked space to the extension overlay props. Keep shared `space.colors` and compatible existing group data; never bundle or manually overwrite a client's shared.json. - `sidebar.js` uses Herdr's spaces, panes, machines, theme, layout, window, shared storage, and commands. Menus open with `openOverlay({ mod: MOD, kind: "popup", width: 200, height: 391, props: { role: "menu", space, nested } })`; group menus pass `group`. It uses `space.select`, `space.new`, and `space.move` for native operations. Standard sidebar geometry is read from layout node `sidebar`; do not invent a replacement tree. - `menu.js` builds `[label, command, args, disabled]` rows. Find the clicked space by `props.space`, match its tabs against panes, and store the resulting folder in the folder-open action. Render the action only for client platform `macos` or `windows`; disable it for a remote machine or missing folder before dispatch. - For the folder action, capture the current overlay ID and use `cx.spawn(async (_cx) => { ... })`. On macOS run `exec("open", ["-a", "Finder", folder])`. On Windows run `exec("powershell.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", "$ErrorActionPreference = 'Stop'; (New-Object -ComObject Shell.Application).Explore((Get-Location).ProviderPath)"], { cwd: folder })`. The command text is fixed: do not interpolate a folder into PowerShell or build a shell command from it. Native Explorer API reference: https://learn.microsoft.com/en-us/windows/win32/shell/shell-explore. - Check the returned exit code; show stderr or a useful exit-code error through `notify` on failure, including rejected exec calls. Close the captured overlay in finally. Other existing menu actions retain their native command/dialog routing. Closing a popup before awaiting its process work can destroy the context and cancel subsequent async work. - Inherited sidebar programs/access: `hc machine ls --json`; `git --no-optional-locks -c core.fsmonitor=false status --porcelain=v2 --branch`; Git rev-parse for checkout/common-directory information; `watchFolder` on local Git folders. Git reads can target the owning Herdr machine. Recheck changed locations, newly finished work, returning machines, and repo watch events; keep the inherited one-minute active-window fallback and 15-second machine refresh. The 250ms discovery timer does not mean running Git on every tick. - `dialogs.js` uses gpui-base InputState/Input and the shared group functions. Move lists have explicit height capped at 260px so they do not collapse inside auto-height dialogs. Name dialogs select the existing name, validate uniqueness on the same machine, and disable empty/taken names. - Reuse the installed `mods/workspace-chrome/` icons and theme colors; bundle only the two Lucide arrow SVGs. No HTML, browser APIs, Node UI APIs, or runtime imports from another mod. Preserve the included MIT/Apache/ISC/Feather notices. ### Installation into an existing client 1. Read that client's generated AGENTS.md, current layout, recipe, and package files. Before installing, explain that the mod runs local OS opener programs plus inherited git/hc queries, watches Git folders, and may use the existing Herdr connection for Git reads on remote spaces. The new file-manager action itself is local only; no HTTP listener or download is added. 2. Copy `mods/space-folders/` into the viewing client's app-home mods directory. Include NOTICE and all three license files with the installed mod. Do not copy preview, recipe, generated type files, editor config, or author data into runtime state. 3. Never overwrite a collision. Choose another mod folder name when needed and change only the `MOD` identity, own asset/overlay references, and the layout reference. Keep the independent `space-groups` state key and `space-groups.menu` extension key unchanged for compatibility. 4. Locate the selected layout with `herdr-app status`. Clone a shipped/read-only layout with `layout.clone` before editing it. In the personal layout, change only the existing Spaces block's `content.mod` to this mod's installed name. Preserve its ID, sizes, position, appearance, all other blocks, and keys. Do not modify layouts/.state or copy a whole author layout. No OMP extension, auto-tabs, group-aware Agents panel, or separately installed space-groups mod is required. 5. Existing group memberships remain shared automatically; do not migrate by manually replacing shared.json. Keep the original mod folder available if already installed, but show one Spaces sidebar rather than duplicating panels. Reverting that one layout reference restores the previous sidebar; both understand the same group data. 6. Run `herdr-app check ` and inspect the actual selected window and runtime errors. Then exercise the clicked-space/current-folder case below. Do not claim an inaccessible remote client installed merely because files were copied on an execution host. ## Watch out - Verified with Herdr 0.1.12 on macOS. Actual Finder opening was observed for an inactive clicked space after changing its terminal directory to a unique folder containing spaces and `&`. Windows dispatch, literal-path handling, disabled guards, popup lifetime, and failure reporting were exercised in a disposable logic smoke. **No Explorer window has been tested on a Windows machine.** Verify that native UI before calling a Windows installation fully exercised. - A space can contain multiple terminals. The preserved rule is the first matching pane with a live directory, not the most recently focused pane and not an arbitrary global terminal. A starting-folder fallback is intentional. - Remote spaces cannot be revealed in a local file manager by treating their paths as local. Keep the item disabled; do not add ad-hoc SSH, mounts, syncing, or remote desktop launchers as part of this recipe. Linux/other clients have no new opener item. - The compact rail preserves its inherited click-to-select behavior; the expanded space rows expose the new context menu. Virtual group names are not paths. - The complete sidebar includes grouped-space behavior, but no separate Agents implementation. Existing group-aware panels can reuse the shared key. No runtime code imports from the original space-groups folder are allowed. - The mod namespace and shared data key are deliberately different. Changing both during a collision rename loses visible groups and breaks group-aware integrations. Keep one active sidebar to avoid duplicate polls and controls. - Core machine availability changes what can be pruned. Do not delete memberships just because an offline machine temporarily has no listed spaces. - Menu geometry must allow the added 31px row. This build raises the popup maximum from 360 to 391px; third-party menu extensions can still outgrow a fixed maximum and may require a separately scoped layout change. - `exec` rejects if a program cannot start. Keep error reporting and managed task lifetime; do not dismiss the popup before the awaited opener completes. Do not keep a callback's cx for later unrelated use. - Do not commit cache snapshots, personal paths, real machine/space names, session history, user settings, generated editor/type files, or full-window screenshots. Use a real safe demo and crop only its menu for preview.png. Do not mock up a Windows screenshot and present it as tested. ## Done when - The package contains the complete eight-file mod, this ordered brief, README, an actual safe preview.png, and license/attribution files; no layouts or key-binding override is bundled. - `herdr-app check ` passes, the client actually renders its own `space-folders` context menu, and `herdr-app status` reports no runtime errors. - Right-clicking an inactive local space and choosing the opener reveals that space's live directory, not another active space or its old starting folder. A directory containing spaces and `&` still opens as one literal path; the popup closes after launch. - A remote or missing-folder action cannot launch locally; a launch failure produces a visible notification. Other client platforms and group menus do not show a misleading folder opener. - Existing selection, groups, nesting, folding, drag/reorder, worktree actions, extension menu items, and native commands remain intact. Existing groups remain visible without copying private state, and the original sidebar can be restored by reverting only the layout reference. - On Windows, a real Explorer window should be checked on a Windows client. Until that happens, report logic coverage separately from native UI verification. - Publish the folder in a public GitHub repository with topic herdr-mod. Verify the public recipe and source tree; do not claim the gallery listing is indexed until observed.