Repository navigation
feat(app): arrange the main window from a Layout page in Options - #309
Conversation
The server monitor, the session list and the bottom panel take fixed places around the terminal: the top or bottom of the left or right column, or under the terminal. A Layout page in Options shows a thumbnail to drag them in, a select per block, presets and Restore defaults. The places are kept per device in monitorSlot, sessionListSlot and bottomPanelSlot, read from monitorSide and bottomPanelSide in older files; the context menus' moves change the same settings and end with Layout…. Closes #307 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nMqJEvqPnRmPgi6dnraZM
The Options window's tree gained the Layout entry under General; the main window scenes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nMqJEvqPnRmPgi6dnraZM
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f48d5476a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if p.ok && !(p.b == blockPanel && m.panelHidden) { | ||
| m.rightMin = max(m.rightMin, blockMinWidth(p.b)) |
There was a problem hiding this comment.
Restore the panel's minimum width when expanding it
When the panel shares the right column with the monitor or session list, collapsing it now allows the column to be resized down to 180 DIPs, which is stored in a.rightWidth. Expanding the panel through setBottomPanelHidden(false) does not call widenForPanel, and fitWidths only reduces widths, so the expanded panel remains narrower than its required 410 DIPs. This can clip panel content, particularly the Processes details panes. Enforce the panel minimum when showing it again, or clamp the drawn width to the current minimum.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed with a test and fixed in 6c5a0d4. TestPanelBackIntoNarrowColumn failed in five of its eight cases before the fix (panel shown again by the arrow button, the menu item or the shortcut; restored after maximize; its own window closed). The right column is now always drawn at least as wide as what it shows needs, and widenRightColumn raises and saves the kept width at the start of each frame, in place of the calls at individual sites.
Generated by Claude Code
The right column could be dragged to 180 DIPs while the panel was away (hidden beside another block, maximized or in its own window) and stayed that narrow when the panel came back. Now it is drawn at least as wide as what it shows needs, and its kept width is raised to that in one place, whatever brings the panel back. The thumbnail shows short block names (the full name is the tooltip and accessible name) in columns at least 84 DIPs wide, and the English presets have shorter names, so both fit with fonts a fifth wider. Refs #307 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nMqJEvqPnRmPgi6dnraZM
Summary
Adds a Layout page to the Options window (under General) that arranges the main window, as approved in #307. The server monitor, the session list and the bottom panel take fixed places around the terminal, which does not move: the top or bottom of the left column, the top or bottom of the right column, and under the terminal. The monitor and the session list take any column place; the panel takes the place under the terminal or a right-column place. A block alone in a column fills it; an empty column goes away.
The page has a thumbnail of the main window to drag the blocks in, a "Position" select per block that lists only the places it may take, the four presets (the matching one shown pressed), Restore defaults and a hint line. While a block is dragged, both columns and the place under the terminal show (an empty column too), the allowed places are outlined, the place it left says "Original place", the place under the pointer fills, a line above says what the drop does ("Drop: Left column, top · swaps with the server monitor"), the terminal and the places it may not take are dimmed, and Escape cancels. The existing context-menu entries stay and change the same settings. Each of those menus, and the session list's blank-area menu (as in the mockup), now ends with "Layout…", which opens the page.
Design
internal/app/layout.go, pure functions):arrangementis one place per block.placemoves a block. A block in the way takes the mover's old place, or if it may not go there, its first free allowed place: for the panel that is under the terminal, for the monitor or session list the left column first, then the right. A disallowed place changes nothing. There are 24 reachable arrangements: 12 with the panel under the terminal and 6 + 6 with it in the right column. Presets are compared on what the window shows (a block alone in a column counts the same at top or bottom).monitorSlot,sessionListSlot,bottomPanelSlot(leftTop,leftBottom,rightTop,rightBottom,underTerminal), inlocalSettings. A file without all three is read frommonitorSide/bottomPanelSide: monitor right goes to the right column's top, panel right to the right column's bottom, which is the layout it had before. Two blocks in one place, a disallowed place or a missing key loads as the default. The old keys are still written next to the new ones (rightwhen the monitor or panel is in the right column), so an older version shows the nearest layout it can (with the session list always on the left). An older version that saves the file drops the new keys, and this version then migrates again from the old ones.sidebarWidth(left column),monitorPercent(top share of the left column),rightPanelWidth,rightMonitorPercent(top share of the right column),terminalPercent. A swap keeps every divider where it was, and double-click still resets each one. The keys keep their names; the docs describe their new meaning.fitWidths,fitPercent); the saved values do not change.internal/app/layoutview.go): it builds a left column, the terminal with the place under it, and a right column from the model, instead of special cases. In the default layout the element tree is the same as before, and the README main-window scenes are pixel-identical. A hidden panel next to another block in the right column collapses to its tab row in its own place (top or bottom); hidden alone there, it removes the column and leaves the strip, as before. Maximize, the panel's own window, hide, the session list's pages and header buttons, Close all, the monitor's menu and full screen all follow the block.Absolutesibling, so the copy that follows the pointer is the clean block).Differences from the mockup
Screenshots
The main-window README scenes are unchanged (
go run ./tools/screenshotsleaves them byte-identical). The four Options-window scenes (file icon themes, color scheme, background image, shortcuts) change only by the new "Layout" entry in the page tree. They are updated in a separate commit, which can be dropped if you prefer to keep them as they were.Closes #307
Testing
go build ./...,go vet ./...,GOOS=windows go vet .,GOOS=darwin go vet .,go tool mygo vet, toolchaingofmt -l .(empty)go test -race -count=1 -timeout 30m ./...: all packages passlayout_test.go: every one of the 125 place combinations checked againstvalid; all 24 arrangements; every move from every arrangement (swap, fallback, disallowed); every arrangement reaches every other; settings round trip, old keys, impossible combinations; an old file loaded by the app;fitWidthsat the minimum window for all 24 arrangements.layoutpage_test.go: the page in both languages; every arrangement reached by dragging in the thumbnail and by the selects, with the main window and the thumbnail checked against it; the selects list only allowed places; swap, push-out to under the terminal, disallowed drops, Escape cancel, the drop texts, the empty left column disappearing; drag visuals; presets, the pressed preset, Restore defaults (sizes too); context menus in step with the page, swaps when the target is taken, "Layout…" from all three menus; scenes for the four presets, the session list in the right column and everything on the right.layoutarrange_test.go: in seven arrangements (default, session list on top, panel on the right, monitor on the right, session list on the right, session list over the panel on the right, everything on the right): hide/show, maximize/restore, own window, the connections page and back, full screen, Close all; every divider by mouse, double click and arrow key; a swap keeps the divider; at 900 × 560 every arrangement, panel shown or hidden, keeps all minimums and shows every block.TestReadmeScreenshotsandTestLayoutInBothLanguagesare unchanged.Changes after review
widenRightColumn) instead of a call at each site.TestPanelBackIntoNarrowColumncovers the arrow button, the menu item, the shortcut, restore after maximize, closing the panel's window, a preset, a drag and a settings file.Generated by Claude Code