Skip to content

Repository files navigation

herdr-layout-tools

Rearrange herdr panes without restarting anything. Same tab id, same pane ids, live processes untouched.

Layout editor

What it does

Action Key What it does
Layout editor prefix+shift+l Pick a layout in a popup and apply it.
Equalize prefix+shift+e Set every split back to 50/50.
Reshape: main-left prefix+m Focused pane on the left, the rest in a right column.
Reshape: main-grid prefix+shift+m Same, but the right side is a 2-row grid.

Keys avoid herdr's defaults: prefix+e is edit_scrollback, prefix+l is focus_pane_right.

The editor

Six templates. The preview shows each pane with its agent name or its folder.

Template Shape
Main left + right column one big pane left, the rest stacked right
Main left + right grid right side fills 2 rows per column
Main top + bottom row one big pane on top, the rest side by side
Even columns every pane a full-height column
Even rows every pane a full-width row
Even grid (2 rows) column-major grid, odd pane takes a full column
Key Does
/ mouse choose a template
main pane width, 35–70%
m change which pane is main
/ click again apply
q cancel

Install

herdr plugin install edouard-andrei/herdr-layout-tools

Needs herdr 0.8.0+ and node. For local development, clone it and run herdr plugin link ~/herdr-layout-tools.

Then add the keys to ~/.config/herdr/config.toml, because herdr manifests cannot declare keybindings:

[[keys.command]]
key = "prefix+shift+l"
type = "plugin_action"
command = "edi.layout-tools.open-editor"
description = "layout editor"

[[keys.command]]
key = "prefix+shift+e"
type = "plugin_action"
command = "edi.layout-tools.equalize"

[[keys.command]]
key = "prefix+m"
type = "plugin_action"
command = "edi.layout-tools.reshape-main-left"

[[keys.command]]
key = "prefix+shift+m"
type = "plugin_action"
command = "edi.layout-tools.reshape-main-grid"

Run herdr server reload-config to apply.

Run it without keys

herdr plugin action invoke edi.layout-tools.open-editor
node ~/herdr-layout-tools/equalize.mjs --pane <id>
node ~/herdr-layout-tools/reshape.mjs  --pane <id> [--main-width 0.6] [--rows 2] [--label dev]

--pane defaults to $HERDR_PANE_ID. An agent can also drive this through SKILL.md.

Why it works this way

herdr has no single call that changes topology, keeps processes, and keeps the tab:

Operation Same tab? Processes kept?
pane move into the same tab no-op, does nothing
layout.apply with tab_id no, new tab id no — rebuilds panes from a description
pane move into another tab no yes — moves the live terminal
layout.set_split_ratio yes yes — ratios only, no topology

So reshape parks every non-main pane in a scratch tab, then replays them into the original tab in the target shape. The scratch tab closes itself. You see a short flicker; ids and processes survive. Equalize never leaves the tab.

The editor is a keybinding, not a menu item, because herdr 0.8.0 has no plugin slot in its UI: the right-click menu is compiled in, and plugin v1 has no runtime action registration. A plugin action can only come from a keybinding, a ctrl+click on a URL, or the CLI. So the key opens a placement = "popup" pane, which herdr feeds both keys and mouse clicks.

Files

File Role
editor.mjs the popup: reads the tab, previews, applies
layouts.mjs pure templates, rects, box-art preview
open-editor.mjs opens the popup via plugin.pane.open
reshape.mjs builds the tree, calls applyTreeInPlace
equalize.mjs one layout.set_split_ratio per uneven split
herdr.mjs CLI + socket helpers, scratch-tab replay
node test.mjs   # pure logic, no herdr needed

herdr's --ratio means the first (left/top) child's share. If a reshape ever comes out mirrored, flip firstRatio in herdr.mjs to 1 - r.

About

herdr plugin: in-place reshape (main-left + grid) and equalize — same tab id, same pane ids, processes preserved

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages