fix(psmux): IP/VPN pill renders blank — split text and colour into two options - #161
Conversation
The operator/VPN pill was poked into psmux as a single pre-styled string:
set -g @vpn_pill '#[fg=#9ece6a,bold]<glyph> <ip>'
The status bar reads #{@vpn_pill}, but an option VALUE that embeds a #[…]
style run is not re-interpreted when the format expands it — the segment
renders blank. That is why 'psmux-pill-status' showed a populated cache
(a plain FILE write, separate code path) while the bar stayed empty.
Split the transport to mirror the proven @tn_* colour pattern:
- @vpn_pill now carries PLAIN text only (glyph + address, no #[…]).
- @vpn_fg carries the accent hex, applied in status-left as
#[fg=#{@vpn_fg}]#{@vpn_pill}. Defaulted in the conf so the colour is
never empty on first paint / after a reload (harmless to default — only
the text must not be defaulted, to avoid clobbering the poked value).
psmux-netinfo.ps1 pokes both options (colour first, then text).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016vBxayZLa4h9xhJiJxYVVZ
There was a problem hiding this comment.
Pull request overview
Fixes the psmux operator/VPN status “pill” rendering blank by changing the transport from a single pre-styled option value to two separate options: one for plain text (@vpn_pill) and one for the accent colour (@vpn_fg). This aligns with the existing @tn_* palette usage pattern in psmux.conf and avoids relying on style runs embedded inside option values.
Changes:
- Update
psmux-netinfo.ps1soPill()stores plain text in@vpn_pilland separately pokes@vpn_fgfor colour. - Update
psmux.confstatus-leftto apply@vpn_fgas a style when rendering@vpn_pill. - Add a default
@vpn_fgvalue in config (with rationale) to avoid emptyfg=on first paint/reload.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| psmux/scripts/psmux-netinfo.ps1 | Stores pill as plain text and pokes @vpn_fg + @vpn_pill separately for correct render behavior. |
| psmux/psmux.conf | Renders pill using #[fg=#{@vpn_fg}] (and adds a default) so the bar can colourize the plain-text pill. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # The pill's TEXT and its COLOUR are poked as two separate options: @vpn_pill (plain text, | ||
| # no #[…]) and @vpn_fg (accent hex, applied below as #[fg=#{@vpn_fg}]). They must stay split | ||
| # — a #[…] style run stuffed inside @vpn_pill is not re-interpreted on expansion and the | ||
| # segment renders blank (that was the "pill never shows" bug). Unlike @vpn_pill, @vpn_fg IS | ||
| # defaulted (harmless — it's just a colour; the refresher re-pokes the live one each cycle), | ||
| # so #[fg=#{@vpn_fg}] is never empty on the first paint or right after a reload. | ||
| set -g @vpn_fg "#9ece6a" | ||
| set -g status-left " #[fg=#{?client_prefix,#{@tn_orange},#{?pane_in_mode,#{@tn_yellow},#{@tn_blue}}},bold]#S#{?client_prefix, ,#{?pane_in_mode, , }}#[nobold,fg=#{@vpn_fg}]#{@vpn_pill}#[default] " |
There was a problem hiding this comment.
Correct that the default is overwritten on reload — that tradeoff is deliberate, and the format-time fallback is the right eventual shape but not yet safe to adopt here:
- Impact is narrow and self-healing. Green is the common-case (LAN) color, so the clobber only shows a wrong color when you're on a VPN (orange) and reload the config, and only until the next refresher tick (≤60s), which re-pokes the live color. No wrong color on a fresh session or on LAN.
- The suggested fallback depends on an unverified psmux feature.
#[fg=#{?@vpn_fg,#{@vpn_fg},#9ece6a}]needs psmux to support a truthiness conditional on a user option (#{?@vpn_fg,…}). Thisconfonly documents what was actually probed on psmux 3.3.7 (status 2/status-format[1]/centre/monitor-*/bg=default), and option-truthiness isn't on that list. After the monitor-bell regression (a CLI probe passed but the parser rejected the option), the bar's policy is to not put an unverified construct on the render path.
So I'm keeping the known-safe set -g @vpn_fg default for now. Once #{?@user_option,…} is confirmed on this psmux build, switching to the format-time fallback (dropping the default entirely) is a clean one-line follow-up.
Generated by Claude Code
What
The psmux operator/VPN pill (
#{@vpn_pill}instatus-left) never showed, even whenpsmux-pill-statusreported a populated cache. Root cause: the pill was poked into psmux as a single pre-styled string:The bar reads
#{@vpn_pill}, but an option value that embeds a#[…]style run is not re-interpreted when the format expands it — so the segment renders blank. Thepsmux-pill-statuscache looked fine because that's written by a separate.NET File.WriteAllTextcode path (a plain file), independent of thepsmux setpoke the bar actually reads.Fix
Split the transport to mirror the proven
@tn_*colour pattern (which demonstrably works in this samestatus-left):@vpn_pillnow carries plain text only (glyph + address, no#[…]).@vpn_fgcarries the accent hex, applied instatus-leftas#[fg=#{@vpn_fg}]#{@vpn_pill}(orange = tunnel, green = LAN).@vpn_fgis defaulted in the conf so#[fg=#{@vpn_fg}]is never empty on first paint / after a reload. Defaulting the colour is harmless (the refresher re-pokes the live one each cycle); only@vpn_pill's text must stay undefaulted to avoid clobbering the poked value.psmux-netinfo.ps1now pokes both options (colour first, then text) and stores the pill as plain text.Files
psmux/scripts/psmux-netinfo.ps1—Pill()stores plain text + accent; poke sets both@vpn_fgand@vpn_pill.psmux/psmux.conf—status-leftuses#[fg=#{@vpn_fg}]; addedset -g @vpn_fgdefault + rationale comment.Testing
Live on the author's Windows host:
The LAN IP should now appear in
status-left(green glyph + address); on a VPN it shows the tunnel iface/addr in orange.🤖 Generated with Claude Code
Generated by Claude Code