Thanks for the quick reply and help.
On Fri, May 31, 2024 at 12:05 AM Nicholas Marriott
<
nicholas...@gmail.com> wrote:
> You can set window-size to control which session sets the window size but you
> can only pick largest, smallest or latest, there is no way to have it pick the
> oldest session (I don't think this would be hard to add if you wanted).
Ok, got it. I don't have intuition for the experience `oldest` would provide.
I think it might truncate content when using a smaller client, if the `oldest`
client's window is larger, which I'm not sure I'd want. tmux's default settings
do work perfect for me, this one quirk is more due to my lack of understanding.
> It doesn't resize when you switch focus because simple changing focus
> does not make a session the latest, it should resize when you type.
tmux does resize on focus change, no need to type. In the case where it didn't
resize (when changing back to the second client; in my original post,
thread-top), there were two different windows active, so no resizing ought to
occur.
> If aggressive-resize is on it shouldn't resize unless the sessions share a
> current window so if you are using different current windows you might want to
> turn that on.
Ok, thanks for the tip.
In the end, I may not use a session group and just side-step this altogether. I
used a session group because I wanted the convenience of accessing other windows
in the second client, and I've since realized it's trivial to change sessions.
With more experimentation and adding a few log_debug() calls, I think I can
explain what's happening, so I thought I'd wrap up this thread for anyone
interested..
I noticed `new-session -t [..]` opens on the first window of the first client (I
guess actually the first session in the targeted group). This causes a resize,
if the second client is smaller. I see the resize check happens in the
server-client loop, via flags and other criteria.
At the end of the second client command sequence:
`new-session -t [..] ; new-window`
..there will be no "contention" for the first client's window. However, of
course tmux doesn't "know" that after the new session starts, a new window will
be created and activated, and presumably the same (as above) window resize
checks happen between the commands, thus the first client resize occurs.
Makes sense, because a command sequence can be long (so tmux musn't wait and do
the reconciliation at the end), but also due to the overall design: the
server-loop and async command processing, to allow for multiple clients,
sessions, etc.
Now that I think I understand this better, I may try to cause the first client
to notice there is no longer another client sharing its window, with the hope it
would resize back on its own; e.g., `new-s ; new-w; <something>`. Maybe a hook
or control mode command could work.
Regards,
richard