pi-focus-aware-blinking-cursor
v0.1.1
Published
Blinking cursor when focused; border dims when the terminal loses focus (pi TUI)
Readme
pi-focus-aware-blinking-cursor
Blinking cursor + focused/unfocused distinction for the pi TUI:
- Focused: fake cursor cell blinks on/off at ~2 Hz; border keeps pi's dynamic color (thinking level / bash mode).
- Unfocused: cursor hidden entirely; border dimmed.
- Immediate on movement: the blink phase resets when the cursor moves (typing, arrows, word jumps like option+f, scrolling) or when focus returns, so the cursor reappears instantly instead of waiting out the current "off" half of the cycle.
"Focused" is two independent signals, both required for the blink:
- TUI focus (
Editor.focused): the input editor is the active component (loses focus while selectors/overlays are open). - Terminal focus: the terminal window itself. pi's TUI consumes the terminal's focus-in/focus-out sequences internally before extension input listeners run, so this extension watches raw stdin for them. In regular (non-fullscreen) mode focus reporting is off and the cursor blinks regardless of window focus.
Install
pi install ./extensions/focus-aware-blinking-cursor-and-border # local
pi install npm:pi-focus-aware-blinking-cursor # npm (if published)pi's git sources clone a whole repository and install what its root
package.jsondeclares; the pi-collections root is never published and declares nopimanifest, so there is nogit:.../pi-collections/...form. To install just this extension from the repo, clone it andpi installthe subdirectory locally, or publish it to npm.
Or add it to the packages array in ~/.pi/agent/settings.json:
{
"packages": ["./extensions/focus-aware-blinking-cursor-and-border"]
}Notes
- Works with
scroll-speedin any load order: it delegates to a previously registered editor factory instead of replacing it. - Requires fullscreen (alt-screen) TUI mode for the terminal-focus signal.
- Works with pi's
showHardwareCursorsetting: the zero-width hardware-cursor marker pi-tui emits next to the fake cursor is stripped on the "off" half of the blink, so the terminal's own (non-blinking) cursor doesn't keep the cell permanently visible.
