Skip to content

sidebar: add tmux_window_index - #215

Merged
raine merged 2 commits into
raine:mainfrom
alebiscotto:feat/sidebar-window-index-token
Aug 4, 2026
Merged

sidebar: add tmux_window_index #215
raine merged 2 commits into
raine:mainfrom
alebiscotto:feat/sidebar-window-index-token

Conversation

@alebiscotto

Copy link
Copy Markdown
Contributor

Implements #214: a {window_index} template token that shows the agent's tmux window number in sidebar rows, matching native tmux navigation (prefix+N, status bar numbers) instead of sidebar ordering.

How

  • #{window_index} is appended as a trailing field to the sidebar daemon's existing list-panes poll format, and parsed leniently (missing/non-numeric → unset), so mixed daemon/client versions tolerate each other's lines
  • build_snapshot stamps agent.window_index from the poll each tick, mirroring window_id — window renumbering and moves stay accurate
  • AgentPane.window_index: Option<u32> with #[serde(default)] for state-file/RPC backward compatibility; backends without window indexes leave it None and the token renders empty
  • Styled dimmed, same as {idx}/{jump_key}; docs table updated

Testing

  • cargo test: 1394 passed, 0 failed (includes new tests: token parse roundtrip, resolve set/unset, snapshot stamping + stale-index clearing)
  • cargo fmt clean; cargo clippy --all-targets introduces no new warnings in touched files

@alebiscotto

Copy link
Copy Markdown
Contributor Author

Pushed a second commit adding a sidebar.sort config option (recency default | window): with window numbers visible, recency ordering makes the displayed numbers shuffle as agents work; sort: window keeps rows in tmux window order so the sidebar matches the window list. Happy to split it into a separate PR if you prefer.

@alebiscotto alebiscotto changed the title sidebar: add {window_index} template token sidebar: add {tmux_window_index} template token Aug 4, 2026
@alebiscotto alebiscotto changed the title sidebar: add {tmux_window_index} template token sidebar: add tmux_window_index Aug 4, 2026
Shows the tmux window number (e.g. 3 for 3:wm-feature-auth) in sidebar
rows, so the displayed number matches native tmux navigation (prefix+N,
status bar) instead of the sidebar-order {idx}.

The index is read from the daemon's existing list-panes poll as a
trailing format field and stamped onto agents in build_snapshot,
mirroring window_id. It refreshes every tick, so renumbered or moved
windows stay accurate. Backends without window indexes render it
empty.
'window' orders rows by session and tmux window index, keeping the
list stable while agents work and matching the tmux window list.
Pairs with {window_index}. Default remains 'recency'.
@raine
raine force-pushed the feat/sidebar-window-index-token branch from 2054434 to f1e376d Compare August 4, 2026 18:59
@raine
raine merged commit ecb8f72 into raine:main Aug 4, 2026
@raine

raine commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Thanks!

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.

2 participants