diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-20 02:46:52 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-20 02:46:52 -0400 |
| commit | 7e8f771408b7051066fb91fa9c68e80fa52405f7 (patch) | |
| tree | 367b7209af1c725dbfdf11b321ee6948fa4ac096 /modules/ai-term.el | |
| parent | 63eff9be3bdb86239ba8d3d5aa916ad08967b238 (diff) | |
| download | dotemacs-7e8f771408b7051066fb91fa9c68e80fa52405f7.tar.gz dotemacs-7e8f771408b7051066fb91fa9c68e80fa52405f7.zip | |
feat(windows): dock companion panels by a shared min-column rule
The F9 agent always docked as a right-side column on a landscape frame. On this 138-column frame that left ~68-column panes, too cramped to read code and the agent side by side. The F12 terminal and F10 playlist hardcoded a bottom split with no width-aware path.
I added cj/preferred-dock-direction and the cj/window-dock-min-columns defcustom (default 80) to the window-geometry lib: dock side-by-side only when the narrower pane keeps at least the minimum width, otherwise stack below. All three toggles now route through it. F9 drops its pixel-aspect rule. F12 and F10 gain a right-column width default and become adaptive. F10 keeps width and height size memory in separate vars so a resize on one axis doesn't leak to the other.
Diffstat (limited to 'modules/ai-term.el')
| -rw-r--r-- | modules/ai-term.el | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/modules/ai-term.el b/modules/ai-term.el index 49d44d25e..8dfd5e370 100644 --- a/modules/ai-term.el +++ b/modules/ai-term.el @@ -391,21 +391,17 @@ fallback when `cj/--ai-term-last-size' is nil." :type 'number :group 'ai-term) -(defun cj/--ai-term-direction-for-aspect (pixel-width pixel-height) - "Return the space-conserving dock direction for a frame of PIXEL-WIDTH by -PIXEL-HEIGHT. `right' when the frame is wider than tall (dock from the right -edge), `below' when it is square or taller (dock from the bottom)." - (if (> pixel-width pixel-height) 'right 'below)) - (defun cj/--ai-term-default-direction (&optional frame) "Return the default split direction for the agent window. -Chosen at display time from FRAME's pixel aspect ratio (FRAME defaults to the -selected frame): `right' on a landscape frame, `below' on a square or portrait -one -- whichever edge conserves more screen space." +Chosen at display time from FRAME's column width (FRAME defaults to the +selected frame): `right' when a side-by-side split would leave both the +agent and the main window at least `cj/window-dock-min-columns' wide, +`below' otherwise. The agent's share of the width is +`cj/ai-term-desktop-width'. See `cj/preferred-dock-direction'." (let ((frame (or frame (selected-frame)))) - (cj/--ai-term-direction-for-aspect (frame-pixel-width frame) - (frame-pixel-height frame)))) + (cj/preferred-dock-direction (frame-width frame) + cj/ai-term-desktop-width))) (defun cj/--ai-term-default-size () "Return the default size fraction paired with the chosen direction. |
