Add configurable workspace display substitutions - #15
Merged
qu8n merged 4 commits intoSep 10, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d3a35c7-0a5f-4e6c-9a09-567c989e068d
qu8n
requested changes
Aug 31, 2026
qu8n
left a comment
Owner
There was a problem hiding this comment.
Thanks for contributing! Great suggestion. I left two small comments.
qu8n
added a commit
that referenced
this pull request
Sep 10, 2026
WORKSPACE_SUBSTITUTE_SETS shortens the name herdr takes from the directory without touching the directory or the worktree. The rewrite is the sidebar's alone, so tabs go on deduping against the derived name: deduping against the rewrite would have a tab re-inject the long spelling the label was shortened to lose. Numbering is no longer the only reason the workspace pass runs, since a rewrite has to reach a workspace nobody numbered. That leaves the pass needing a way to end: an owned workspace keeps it alive for one more pass once the rules are deleted, which hands the derivation back and drops the record, and herdr resumes labelling from there. `clear` takes the same route, having otherwise stripped the number off a rewrite and left that standing on the way to uninstall. Refs #15 Co-authored-by: Samuel Mendenhall <smendenhall@workm5.local>
The branch was opened against 0.8.0 and main has moved to 0.10.0. The engine it patched has been reworked since: per-session state took the fourth ar_state_set argument this change also wanted, ar_fast_workspace renames workspaces from the shell hook, and ar_renumber_workspaces reads its rows with their status. Conflicts are resolved to main, and the feature is rebuilt against it in the commits that follow. # Conflicts: # CHANGELOG.md # README.md # automatic-rename.sh # tests/test_ws_cwd.sh
WORKSPACE_SUBSTITUTE_SETS shortens the name herdr takes from the directory without touching the directory or the worktree. The rewrite is the sidebar's alone, so tabs go on deduping against the derived name: deduping against the rewrite would have a tab re-inject the long spelling the label was shortened to lose. Numbering is no longer the only reason the workspace pass runs, since a rewrite has to reach a workspace nobody numbered. That leaves the pass needing a way to end: an owned workspace keeps it alive for one more pass once the rules are deleted, which hands the derivation back and drops the record, and herdr resumes labelling from there. `clear` takes the same route, having otherwise stripped the number off a rewrite and left that standing on the way to uninstall. Refs qu8n#15 Co-authored-by: Samuel Mendenhall <smendenhall@workm5.local>
A rewrite gave the workspace pass a second reason to run, and it went on to do things the config never asked for. The pass ran for a third reason too, that this plugin OWNS a workspace, so it could take a rewrite back once the rules were deleted. That runs for every config that has ever numbered one, and turning numbering off then deleted every ownership record: a cd later, the workspace was opted out of directory tracking for good, with no reset action to recover it. The reason is gone. A rewrite is derived fresh from identity_cwd each pass rather than built out of the last label, so deleting the rules restores the derived names by itself wherever the pass still runs, and where it does not the `clear` action is what puts them back. What the pass does once it runs is now scoped the same way. Numbering that was never named is not switched off but absent, so the pass carries each row's own prefix over instead of stripping it, and a row it does not own comes out unchanged. `clear` reads herdr's derivation only when there is a rewrite to hand back, having otherwise renamed every workspace to wherever identity_cwd pointed on the one pass with no follow-up, and it reads the pane list beside it so a session.json that lags a live cd cannot freeze the directory the workspace just left. The prefix is taken back off the label rather than rebuilt from it. ar_index_prefix is documented as ar_strip_prefix's exact inverse and is not one: "[1]: [done] task" strips to itself while ar_index_prefix still reads a "[1] " off it, and re-joining the two renamed a row the pass had promised to leave alone. The shell hook answers all of this the way the reconcile does, or the two undo each other every prompt. Two more the rewrite could reach on its own. The debounce guard compares the record against the pane's base rewritten, since the record holds a label and a label carries the rules; compared raw it could never match a workspace a rule touched, and the reconcile reverted every rename the prompt made. And an empty rewrite is refused, because sed rejects a malformed rule and hands back nothing, and a blank label would freeze the derivation of the row it blanked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WORKSPACE_SUBSTITUTE_SETSrules for directory-derived workspace labelsExample
WORKSPACE_SUBSTITUTE_SETS=( 's|^worktree-|wt-|' )This displays
worktree-featureaswt-feature.Validation
make syntaxmake testmake lint