Repository navigation
[idea] Dynamic tab labels via template support ({cwd_basename}, {terminal_title}) while preserving manual names #4876
Replies: 1 comment
|
I'd like this too: I use Herdr desktop 0.1.13 on macOS with several Claude Code and Codex sessions, and numeric tab labels make it hard to tell the sessions apart. I'd like unnamed tabs to follow the AI session name, including later renames or a new session in the same tab, while keeping manually assigned tab names. The related tab-title request was redirected to Ideas; I realize this discussion concerns the terminal version, but the same need exists in the desktop app. Given the desktop contribution policy, should desktop users handle this entirely through a personal tab-bar mod, or would you consider it for the shipped tab bar? I would be happy to work on this if it is a change you would consider accepting; please let me know the preferred scope and contribution path before I start. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Add support for template variables (such as
{cwd_basename}or{terminal_title_stripped}) in tab labels under[ui], applying only to auto-named tabs and respecting user-assigned manual names.The Problem
In multi-repo or agentic setups, users frequently navigate between repositories or run agents in distinct project directories. Static numbering (
1,2,3) forces the user to remember which tab hosts which project, leading to disorientation.Attempting to solve this externally with shell hooks (
precmd,chpwd) or agent wrappers callingherdr tab renamehits major architectural walls:tab.renamesetscustom_name = Some(...)irrevocably, freezing auto-numbering, breaking the DIM tab-bar styling, and making transient decorations permanent."Argos"or"Hotfix-Prod").Because Herdr already tracks pane state live (CWD via OSC 7 / procfs, and
terminal_titleforwindow_titleand the sidebar), resolving this inside the multiplexer is the cleanest path.Proposed Design
1. Template-driven
tab_labelin configurationIntroduce a
tab_labelsetting under[ui]inconfig.tomlthat accepts template variables already familiar fromwindow_title:{cwd_basename}— e.g.gentle-shell,backend,frontend{cwd}— full working directory path{terminal_title}/{terminal_title_stripped}— dynamic title reported by shell / agent{index}/{number}— tab position index (current default behavior)2. Strict respect for
custom_namecustom_name.is_none()): Dynamically evaluatetab_labelbased on the focused pane's state. If the template is unset or resolves empty, retain the current position number.custom_name.is_some()): The user's explicit name takes precedence. The template is ignored.3. Clear/Reset path for custom names (#3470)
Allow resetting a custom name back to auto-naming:
herdr tab rename <tab_id> --resetlabel: null(or an explicittab.reset_namemethod) to setcustom_name = None.This allows users (or transient scripts) to hand the tab back to the dynamic template without restarting the session.
Edge Cases & Decisions
window_titlealready uses).tab_max_width = 24(or truncation with ellipsis) would prevent long directory names from overflowing the tab bar.All reactions