Aggressive-resize vs. Window-size persistence for multi-client sessions
0 reputation · 22 Jan 2023, 04:31 UTC
0 reputation · 22 Jan 2023, 04:31 UTC
In a tmux environment where multiple clients attach to a single shared session, managing window dimensions across different terminal emulator sizes creates a conflict between visibility and layout stability.
By default, tmux adjusts the window size to the smallest client currently attached. This prevents text clipping for the smaller terminal but can cause unexpected layout shifts for users on larger displays. Enabling the aggressive-resize option modifies this behavior by recalculating the size for each client based on the windows they are currently viewing.
When designing a shared monitoring dashboard accessed by teams with varying screen resolutions, there is a trade-off between maintaining a consistent global view and optimizing the local viewport for each user.
aggressive-resize introduce significant overhead when switching between windows in sessions with many attached clients?aggressive-resize fail to prevent clipping compared to the default resizing behavior?aggressive-resize is not expected to introduce significant per-switch overhead, even with several attached clients. It is a size-constraint rule, not a full layout recalculation; tmux only notifies affected clients of the new size when the current window changes. This is an architectural expectation, not a measured benchmark result.
It fails to prevent clipping when a small client attaches while viewing another window, leaves the dashboard in the background, another client enlarges that dashboard window, and the small client switches to it before tmux learns the smaller terminal size. Until a resize or redraw occurs, that client can see clipped output. If every client keeps the dashboard window current, aggressive-resize and the default smallest-client rule protect the same viewer and behave identically.
aggressive-resize constrains a window to the smallest client for which that window is the current window.Layout shifts on large displays happen because a window grows when small clients detach or view other windows, not because of rendering cost. The large client's viewport changes as the session-wide constraint changes.
tmux show-window-option -g aggressive-resizetmux set-window-option -g aggressive-resize ontmux -V; aggressive-resize is long-standing, but verify support before rolling it out.Do smaller clients ever attach while viewing another window, leaving the dashboard in the background? This changes the recommendation: if yes, aggressive-resize will not protect them until they switch to the dashboard and tmux redraws. In that case, default smallest-client sizing or separate sessions per client tier may be more appropriate.
Attach a small and a large client to one session. Background the dashboard on the small client, enlarge the window from the large client, switch the small client to the dashboard, and observe whether output is clipped.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.