Skip to content

feat: add --sidebar flag to control sidebar visibility#2917

Merged
dgageot merged 2 commits into
docker:mainfrom
dgageot:board/6cdd2c8c9cd921de
May 28, 2026
Merged

feat: add --sidebar flag to control sidebar visibility#2917
dgageot merged 2 commits into
docker:mainfrom
dgageot:board/6cdd2c8c9cd921de

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented May 28, 2026

Closes #2912

Adds a --sidebar flag to control sidebar visibility in the TUI. When set to --sidebar=false, the sidebar is hidden and the user cannot re-enable it via keyboard shortcut or mouse interaction. The flag defaults to true, preserving existing behavior.

This complements the existing --lean flag, which hides the entire UI chrome. The --sidebar=false option is lighter—it keeps the tab bar, status bar, and dialogs intact while hiding only the sidebar. The implementation gates the Ctrl+B keybinding and sidebar toggle behavior when the sidebar is disabled, and adjusts the chat layout to fill the full width when the sidebar is absent.

Build, lint, and tests all pass. (Unrelated pre-existing failures in pkg/snapshot on macOS stem from /private/var symlink handling and are out of scope.)

@dgageot dgageot requested a review from a team as a code owner May 28, 2026 14:34
trungutt
trungutt previously approved these changes May 28, 2026
@aheritier aheritier added area/cli CLI commands, flags, output formatting area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat: commit prefix) status/needs-rebase PR has merge conflicts or is out of date with main labels May 28, 2026
@aheritier aheritier marked this pull request as draft May 28, 2026 15:01
@dgageot dgageot force-pushed the board/6cdd2c8c9cd921de branch from 86795cf to 28ccdc0 Compare May 28, 2026 15:01
@aheritier aheritier removed the status/needs-rebase PR has merge conflicts or is out of date with main label May 28, 2026
@dgageot dgageot force-pushed the board/6cdd2c8c9cd921de branch from 28ccdc0 to 8bd6368 Compare May 28, 2026 15:46
@dgageot dgageot marked this pull request as ready for review May 28, 2026 17:08
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

The implementation is clean and correct. All hypotheses were investigated and dismissed:

AllBindings() guard change — The comment "leanMode already returned above" is accurate: there is an explicit early-return if m.leanMode { return []key.Binding{quitBinding} } at the top of the function. The prior if !m.leanMode guard on the Ctrl+b binding was therefore always true and redundant. Replacing it with if !m.hideSidebar is the correct change. (The previous commit message even says "simplify AllBindings: remove redundant leanMode guard", confirming intent.)

Mouse interaction when hideSidebar=truecomputeSidebarLayout() returns a layout with sidebarHeight=0 (zero value) and showToggle()==false when hidden. The hit-test y < sl.sidebarHeight (i.e. y < 0) is never true, so no mouse click can reach the sidebar target. The sidebar cannot be re-enabled by clicking.

--sidebar flag default true — Cobra's BoolVar writes the default value immediately at registration time, not at parse time. f.sidebar is true before any command runs, so !f.sidebar is always false at call time unless the user explicitly passes --sidebar=false. No issue.

hideSidebar vs leanMode height difference in View() — Intentional by design: lean mode hides all chrome (no fixed height constraint needed), while --sidebar=false keeps the tab bar and status bar (requires chatHeight constraint). The hideSidebar branch correctly mirrors the default collapsed-sidebar branch.

The sidebarHidden() helper cleanly centralises the guard, WithHideSidebar() correctly disables the keymap binding, and the ToggleSidebarMsg gate in tui.go provides defence-in-depth. Looks good to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands, flags, output formatting area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flag to hide the sidebar

4 participants