How to configure window size behavior in tmux?

Quick Answer

Set window-size latest in your ~/.tmux.conf to make windows adapt to the most recently attached client's screen size, instead of being constrained by the smallest client.

set-option -g window-size latest

Detailed Explanation

By default, tmux constrains all windows to the smallest connected client's screen size. The window-size option controls this behavior, which is especially important when connecting from different devices like phones, laptops, and desktop monitors.

Available Window Size Options

# In ~/.tmux.conf
set-option -g window-size smallest   # Default - constrain to smallest client
set-option -g window-size largest    # Use largest client's dimensions  
set-option -g window-size latest     # Follow most recent client
set-option -g window-size manual     # Fixed size, doesn't auto-resize
  • smallest (default): Everyone sees the same small size
  • largest: Maximizes screen real estate for all clients
  • latest: Adapts to whoever connected most recently
  • manual: Fixed dimensions that don't change

Changing at Runtime

# Change immediately
tmux set-option -g window-size latest

# Check current setting
tmux show-options -g window-size

Pro Tip

Use latest if you frequently switch between devices. Use largest for shared sessions where you want to maximize screen space for all users.

Manual Window Sizing

For precise control, use manual mode and resize explicitly:

set-option -g window-size manual
tmux resize-window -x 120 -y 40