Skip to content

About

Herdr plugin: terminal_title_stripped → tab persistence (session_title alone on top, tab keeps it after close)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

herdr-session-title-name

Live: https://herdr-session-title-name.uft1.com · https://herdr-session-title-name.pages.dev

Herdr plugin: persist terminal_title_stripped as pane label — so hermes --tui -c "hey what is 1 plus 1" shows as session_title on top and stays as pane name after the session closes (tab rename disabled — tab stays 1, github/jovylle, DASH, etc).

  • Sidebar terminal_title_stripped alone on top — builtin herdr stripped OSC title (⠋ hey… → hey…). No $session_name.
  • Pane persistence (splits & singles) — each pane with no manual name auto-renames to its own stripped title. Tabs like github/jovylle with 2 splits now keep both pane names. Numeric tabs like 1, 2 are not auto-renamed — only the pane is.

Rep urposed from herdr-session-name (deprecated) → now herdr-session-title-name. No fork required — pure plugin for upstream herdr 0.8.2+.

Model: Workspace → Tab (layout) → Pane (real terminal). See https://herdr.dev/docs/concepts/ — pane is the important unit for splits.

Install

herdr plugin install jovylle/herdr-session-title-name --yes
herdr plugin list
# if you had the old id:
herdr plugin uninstall jovylle/herdr-session-name 2>/dev/null; herdr plugin unlink jovylle.session-name 2>/dev/null; true
herdr plugin log list --plugin jovylle.session-title-name

How it works

Herdr plugins can't hook terminal_title directly (PaneUpdated not in PLUGIN_HOOK_EVENT_KINDS), so this plugin uses two paths:

  1. Event hooks — tab.created, pane.created, pane.focused, tab.focused, pane.exited → sync.sh fetches herdr api snapshot, renames each empty-label pane to its own terminal_title_stripped via herdr pane rename. Tab rename is disabled.
  2. Startup poller — watch.sh loops every 1.5s calling same sync, catching OSC title changes from hermes --tui -c "..." that don't fire an event.

Guards: only empty pane labels are touched. Numeric tabs ^[0-9]+$ and manual names like DASH, github/jovylle stay as-is (tab never renamed).

Verify:

herdr api snapshot | python3 -c "import json,sys; d=json.loads(sys.stdin.read()); pans=d['result']['snapshot']['panes']; print([ (p['pane_id'], p.get('label'), p.get('terminal_title_stripped')) for p in pans if p.get('terminal_title_stripped')][:5])"
herdr pane list | python3 -m json.tool | head -n 40
herdr tab list | python3 -m json.tool | head -n 40

Sidebar config (herdr native — no plugin config needed)

Herdr docs: https://herdr.dev/docs/configuration/ → Sidebar row layouts — tokens terminal_title_stripped / pane / tab.

Panes vs tabs: show pane token to see per-pane names in splits (instead of or alongside tab).

Untouched config (no ~/.config/herdr/config.toml):

Minimal — title alone on top, plus pane name:

[ui.sidebar.agents]
rows = [
  ["terminal_title_stripped"],
  ["pane"],
]

Or title + pane + tab:

[ui.sidebar.agents]
row_gap = 0
rows = [
  ["terminal_title_stripped"],
  ["state_icon", "pane"],
  [{ token = "tab", fg = "#101010" }]
]

Your current config (~/.config/herdr/config.toml):

[ui.sidebar.agents]
row_gap = 0
rows = [
  { token = "terminal_title_stripped", fg = "#000000" },
  ["state_icon", { token = "tab", fg = "#101000" }]
]
# → add pane token to see split names:
[ui.sidebar.agents]
row_gap = 0
rows = [
  { token = "terminal_title_stripped", fg = "#000000" },
  ["state_icon", { token = "pane", fg = "#101000" }],
  [{ token = "tab", fg = "#101010" }]
]
# Also useful for split borders:
# [ui]
# show_agent_labels_on_pane_borders = true

Apply: herdr server reload-config

Modified config (you already have [ui.sidebar.agents]):

Prepend ["terminal_title_stripped"] as alone row on top — don't replace your other rows.

Fork users: session_title is alias for terminal_title_stripped at /lab/herdr-fork/src/config/sidebar.rs — both work, but plugin docs use upstream terminal_title_stripped.

Pane vs tab demo

# single pane — pane gets the title, tab stays numeric
hermes --tui -c "hey what is 1 plus 1"
# sidebar top: hey what is 1 plus 1
# pane label: hey what is 1 plus 1 (herdr pane list)
# tab bar: 1 (unchanged — auto tab rename disabled)
# exit hermes — pane stays hey what is 1 plus 1

# split tab — each pane keeps its own title
herdr pane split w4P:pD --direction right
# set different titles in each split → each pane label persists

Files

  • herdr-plugin.toml — 0.5.0, hooks + startup poller (pane rename only, tab disabled)
  • sync.sh — sync empty panes to stripped titles via herdr api snapshot (tab rename removed)
  • watch.sh — startup loop calling sync.sh every 1.5s (pane only)
  • rename.sh — legacy shim (calls sync.sh)
  • site/index.html — landing page

Uninstall

herdr plugin uninstall jovylle/herdr-session-title-name
# if linked locally:
herdr plugin unlink jovylle.session-title-name

Redeploy landing: npx wrangler pages deploy site --project-name herdr-session-title-name --branch main

About

Herdr plugin: terminal_title_stripped → tab persistence (session_title alone on top, tab keeps it after close)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages