Skip to content

StatusLine: per-section visibility toggles (wiring pass for #1492) - #2148

Open
asdf8675309 wants to merge 1 commit into
danielmiessler:mainfrom
asdf8675309:feat/statusline-section-toggles
Open

asdf8675309 wants to merge 1 commit into
danielmiessler:mainfrom
asdf8675309:feat/statusline-section-toggles

Conversation

@asdf8675309

Copy link
Copy Markdown
Contributor

I was otherwise commenting these lines out each version change, so I figured it made sense to just make them optional. Found the #1492 .

Lands the section-toggle mechanism accepted in #1492 (@thatsjet) but was not wired through the script: SHOW_HEADER/STATE/EFFORT/DOCTOR/MEMORY/VERSIONS/ AGENTS/CONTEXT/USAGE/QUOTE default true (zero behavior change out of the box), overridable per-user via settings.json so overrides survive version upgrades that overwrite this script:

"preferences": { "statusline": { "sections": { "state": false } } }

Same design #1492 proposed: script-level SHOW_* defaults, a jq eval reading preferences.statusline.sections, key names regex-restricted to ^[a-z]+$ and values normalized to literal true/false so a malformed override can never inject into the eval.

Two additions beyond the original proposal, both for sections that shipped after #1492 was filed: SHOW_INTERVIEW (the interview-due chip) and SHOW_ACCOUNT (the logged-in-account line).

Also replaces #1492's "separators owned by their section" rule with a general had_output flag: sep()/sep_dot() print only when something has appeared since the last divider, then reset. This covers a case the static rule can't: DOCTOR/MEMORY/INTERVIEW render conditionally on a data file's presence even when their SHOW* flag is true, so a fixed "does the section before me have its flag on" check would still leave orphaned separators or a leading rule with nothing above it when data happens to be absent.

…ssler#1492)

Lands the section-toggle mechanism accepted in danielmiessler#1492 (@thatsjet) but never
wired through the script: SHOW_HEADER/STATE/EFFORT/DOCTOR/MEMORY/VERSIONS/
AGENTS/CONTEXT/USAGE/QUOTE default true (zero behavior change out of the
box), overridable per-user via settings.json so overrides survive version
upgrades that overwrite this script:

  "preferences": { "statusline": { "sections": { "state": false } } }

Same design danielmiessler#1492 proposed: script-level SHOW_* defaults, a jq eval reading
preferences.statusline.sections, key names regex-restricted to ^[a-z]+$ and
values normalized to literal true/false so a malformed override can never
inject into the eval.

Two additions beyond the original proposal, both for sections that shipped
after danielmiessler#1492 was filed: SHOW_INTERVIEW (the interview-due chip) and
SHOW_ACCOUNT (the logged-in-account line).

Also replaces danielmiessler#1492's "separators owned by their section" rule with a
general _had_output flag: sep()/sep_dot() print only when something has
appeared since the last divider, then reset. This covers a case the static
rule can't: DOCTOR/MEMORY/INTERVIEW render conditionally on a data file's
presence even when their SHOW_* flag is true, so a fixed "does the section
before me have its flag on" check would still leave orphaned separators or
a leading rule with nothing above it when data happens to be absent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant