Let's say you're connecting to a remote server over ssh with Terminal.app. When you "tmux attach" with bigger resolution monitor from smaller one you previously started tmux, it draws dots around the console. It doesn't fit the new window size. Is there any way to redraw and clean the window? CTRL+L or CTRL-B + R doesn't help. I couldn't find any proper command on man.
% tmux -V tmux 1.5
In order to resize tmux panes, you first hit your tmux prefix ( ctrl + b is the default one. Mine is ctrl + a .), and then the colon key : . This brings up a tmux command mode prompt at the bottom of your screen. All done!
conf . Reload tmux, switch windows at least once and press: ctrl+B (default prefix) + l (lower-case L) works like a charm!
Switching between panes To get from one pane to another, press Ctrl+B followed by O (as in other).
tmux limits the dimensions of a window to the smallest of each dimension across all the sessions to which the window is attached. If it did not do this there would be no sensible way to display the whole window area for all the attached clients.
The easiest thing to do is to detach any other clients from the sessions when you attach:
tmux attach -d
Alternately, you can move any other clients to a different session before attaching to the session:
takeover() { # create a temporary session that displays the "how to go back" message tmp='takeover temp session' if ! tmux has-session -t "$tmp"; then tmux new-session -d -s "$tmp" tmux set-option -t "$tmp" set-remain-on-exit on tmux new-window -kt "$tmp":0 \ 'echo "Use Prefix + L (i.e. ^B L) to return to session."' fi # switch any clients attached to the target session to the temp session session="$1" for client in $(tmux list-clients -t "$session" | cut -f 1 -d :); do tmux switch-client -c "$client" -t "$tmp" done # attach to the target session tmux attach -t "$session" } takeover 'original session' # or the session number if you do not name sessions
The screen will shrink again if a smaller client switches to the session.
There is also a variation where you only "take over" the window (link the window into a new session, set aggressive-resize
, and switch any other sessions that have that window active to some other window), but it is harder to script in the general case (and different to “exit” since you would want to unlink the window or kill the session instead of just detaching from the session).
You can always press CTRL-B + SHIFT-D to choose which client you want to detach from the session.
tmux will list all sessions with their current dimension. Then you simply detach from all the smaller sized sessions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With