Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion psmux/psmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,14 @@ set -g status-left-length 60
# `set -g @vpn_pill '<text>'` on refresh (arm with `psmux-pill-enable`, `-AllNetworks`
# for the plain-LAN IP). Reading #{@vpn_pill} is a free in-process lookup. Deliberately
# NOT defaulted to "" here — a `set` on reload would clobber the refresher's poked value.
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=#{@tn_fg}]#{@vpn_pill}#[default] "
# 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] "
Comment on lines +263 to +270

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,…}). This conf only 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


# ── WINDOWS: flat underlined tabs (Core parity) — inactive muted + activity/bell dots ·
# active blue + underline. No pills here: the flat tabs are what makes the centered
Expand Down
21 changes: 19 additions & 2 deletions psmux/scripts/psmux-netinfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ $ErrorActionPreference = 'SilentlyContinue'
# Stashed by Pill() so the file-write at the bottom can persist the chosen pill
# without re-running detection. Empty string = "render nothing".
$script:LastPill = ''
# The pill's accent colour travels in its OWN psmux option (@vpn_fg), applied as
# #[fg=#{@vpn_fg}] in status-left — see the Pill() note for why the colour can't ride
# inside @vpn_pill. Default green; Pill() overrides it per state (orange tunnel / green LAN).
$script:LastFg = '#9ece6a'

# tokyonight-storm palette. Literal hex on purpose: psmux does not expand #{@tn_*}
# inside #[...] (whether in style options or in #() output), and BG is the bar's
Expand All @@ -53,7 +57,14 @@ function Pill {
param([string]$Accent, [string]$Text)
# Chip-less: plain colored icon+text, no caps/background — matches the transparent
# bar's session/cwd/clock segments (macOS sketchybar + Zebar are chip-less too).
$script:LastPill = "#[fg=$Accent,bold]$Text"
#
# Store the pill as PLAIN text (glyph + address, no #[...]). It's poked into psmux as
# `set -g @vpn_pill '<text>'`, and an option VALUE that contains a #[…] style run is NOT
# re-interpreted when the bar expands #{@vpn_pill} — the segment renders blank. So the
# COLOUR travels separately in @vpn_fg (applied as #[fg=#{@vpn_fg}] in status-left, the
# same way the @tn_* palette colours are consumed), and @vpn_pill carries text only.
$script:LastFg = $Accent
$script:LastPill = $Text
$script:LastPill
}

Expand Down Expand Up @@ -136,4 +147,10 @@ try {
# it with a free in-process lookup (#{@vpn_pill} in psmux.conf's status-left) instead of
# a #(type) shell-out — the lag-safe transport the retired-pill note recommends. Empty
# LastPill (no tunnel / no LAN) clears the segment. Harmless if no psmux server is up.
try { & psmux set -g @vpn_pill $script:LastPill 2>$null } catch { }
# Poke the colour first, then the text: the bar reads #[fg=#{@vpn_fg}]#{@vpn_pill}, so the
# colour option should be current before the text it paints appears. Empty text clears the
# segment. Harmless if no psmux server is up.
try {
& psmux set -g @vpn_fg $script:LastFg 2>$null
& psmux set -g @vpn_pill $script:LastPill 2>$null
} catch { }