Skip to content

feat: allow overriding widget symbols with a custom glyph#431

Merged
sirmalloc merged 3 commits into
sirmalloc:mainfrom
zachthedev:symbol-override
Jun 14, 2026
Merged

feat: allow overriding widget symbols with a custom glyph#431
sirmalloc merged 3 commits into
sirmalloc:mainfrom
zachthedev:symbol-override

Conversation

@zachthedev

@zachthedev zachthedev commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Closes #436.

Lets users replace or remove any widget's hardcoded symbol.

item.character already worked on Git Staged/Unstaged/Untracked but had no editor. This extends it to every widget with a hardcoded glyph and adds a shared (g)lyph keybind plus a tiny editor: type a character or emoji, Backspace renders the widget without a symbol, picking the default clears the override.

Widget Default
Git Branch
Git Worktree 𖠰
Git Worktree Mode
Git Conflicts
JJ Bookmarks 🔖
JJ Workspace
Git Staged / Unstaged / Untracked + / * / ? (now editable in the TUI)

12 files, +366/-33. New shared/symbol-override.tsx carries the keybind, helpers, and editor; each widget adds ~15 lines (keybind entry, renderEditor delegation, prefix helper in render). Preview-path tests cover default/override/suppressed for all nine widgets, plus helper units.

Deferred: Git Ahead/Behind (paired /) and Git Status (composite output) need a different shape than the single character field; happy to follow up if there's interest.

Motivation: nerd-font users who pair widgets with custom-symbol icons end up with doubled glyphs ( ⎇ main); overriding or blanking the builtin fixes that without touching the renderer.

Note: #430 touches some of the same widget files; whichever lands second gets a trivial rebase (conflicts are line-local).

Tested: bun run lint clean; bun test green except the same Windows-environment failures main has.

Extends the item.character override (already honored by Git
Staged/Unstaged/Untracked) to every widget with a hardcoded symbol and
makes it editable in the TUI.

- Add src/widgets/shared/symbol-override.tsx: shared (g)lyph keybind,
  symbol/prefix helpers, and a slot-based editor (type a character or
  emoji, Backspace renders without a symbol, choosing the default clears
  the override); single-symbol widgets store on item.character,
  multi-symbol widgets keep per-part metadata keys
- Wire it into Git Branch (⎇), Git Worktree (𖠰), Git Worktree Mode (⎇),
  Git Conflicts (⚠), JJ Bookmarks (🔖), JJ Workspace (◆), the three
  presence widgets that already supported item.character, and the
  multi-symbol widgets Git Ahead/Behind (↑/↓) and Git Status (!+*?)
- Add preview-path render coverage for default/override/suppressed plus
  helper unit tests; document the keybind in docs/USAGE.md

Co-authored-by: Claude <noreply@anthropic.com>
@sirmalloc sirmalloc merged commit 8ae6481 into sirmalloc:main Jun 14, 2026
2 checks passed
@sirmalloc

Copy link
Copy Markdown
Owner

Thanks, this will go out in the next release. I added a 'Tab' keybind on the glyph editor to revert it to the default glyph, and aligned the labels so it looks nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow overriding the built-in glyph on widgets that hardcode one

2 participants