On Sat, Jan 22, 2022 at 1:11 AM Robert Citek <[email protected]> wrote:

> On Fri, Jan 21, 2022 at 1:45 PM Eric House <[email protected]> wrote:
>
> > > With screen you can resize the terminal size to fit using ctrl-a F  -
> > > that's your screen's control command followed by a capital F.
> >
> > That works! If I have two different terminals ssh'd into the same screen
> > session and resize one then ctrl-A F it, the session in the other
> terminal
> > changes size to match.
> >
> > But: unlike with tmux (which is totally new to me as I said), the two
> > sessions are not kept in sync.
> > If I switch panes in one, or split the window, the other doesn't change.
> > Since one of my sessions will be invisible, I need it to automatically
> > follow whatever I do in the other so that keystrokes will always go
> where I
> > can see them. Is that possible with screen? Seems a useful feature e.g.
> for
> > demonstrating something remotely, but I can't find anything even asking
> how
> > to do it (so I'm probably asking the wrong question....)
> >
>
> tl;dr: don't split screens in multi-user sessions.  Use a single window and
> a single region.
>
> Just a bit of nomenclature to make sure we are on the same page.  There are
> four main objects with screen: a session, a window, a layout, and a
> region.  By default a new screen "session" creates a new "window" and
> displays it in a single "region". But it can get more complex. A session
> can contain one or more windows and one or more regions.  The arrangement
> of regions ( i.e. number, size, position ) is called a "layout".  Regions
> can be blank or display a window. ( This description is simplified, but
> suffices. )
>
> Here's a walk through to demonstrate.  Type the following commands:
>
> screen -dmS foo    # creates a screen session named "foo"
> screen -x foo      # attaches to the screen session named "foo"
>
> At this point you'll have a single screen session named "foo", a single
> window running bash, and a single region displaying the window. Type the
> following commands.
>
> sleep 12345    # this is to keep track of what window we are in
> ^ac            # create a new window running bash
> sleep 54321    # again, to keep track of what window we are in
> ^ac            # create a new window running bash
>
> We now have three windows: one with a bash prompt and two running sleep for
> various times.  Type this commands:
>
> ^a"            # this will list the windows, press the up/down to move
> between windows, press enter to select
>
> That will allow you to switch between windows.  Because we only have a
> single region, we can only view one window at a time.  Type these command:
>
> ^a|            # this will split the region in two with a new blank region
> on the right
> ^a{tab}        # this will change focus to the new region; the {tab} is the
> tab key
> ^a"            # this will list the windows, press the up/down to move
> between windows, press enter to select
>
> You now have two regions, side-by-side, each displaying one of the
> windows.  In fact, you could have both regions displaying the same window.
> As mentioned before, the arrangement of regions is called a "layout".  Type
> these command:
>
> ^ad            # this will detach from the screen session
> screen -x foo  # this will attach to screen session "foo"
>
> Notice that when you detach and then reattach, your layout is apparently
> lost and you have again a single region displaying one of the windows.
> Question:
> Of the three windows, which one will be displayed when you reattach? ( I
> don't know the answer to this, but the choice of window appears arbitrary.
> )    It appears that a second connection behaves the same: it starts with a
> single region displaying one of the windows.  It knows nothing about
> existing regions, any layouts, or what window is in what region.
>
> Question: How do you get two connecting processes to have the same layout
> when connected to the same screen session?  Saved layouts ... maybe.  I'm
> not that familiar with working with layouts and haven't had much success
> with them.  And I'm not encouraged from this in the "layout dump"
> command: "While
> the order of the regions are recorded, the sizes of those regions and which
> windows correspond to which regions are not."  But maybe they'll work good
> enough.
>
> https://www.gnu.org/software/screen/manual/html_node/Layout.html
>
> Another possible solution would be to run screen within screen.  That is,
> create two screen sessions, e.g. foo and bar.  Have both users connect to
> session foo and then connect to session bar.  This does have the desired
> effect of being able to create regions in session "bar" and have all
> regions displayed to both users. However, this gets really confusing really
> quickly, but might work for you.
>
> Admittedly, this post turned out longer than I had intended.  But I hope
> that it clarifies how screen works, at least a little.
>
> Good luck and let us know how things work out.
>
> Regards,
> - Robert
>


This is a nice description of the problem. Since it seems difficult or
impossible to share regions with screen then if you want regions tmux might
still be the solution since tmux will share its equivalent to regions.

The trouble with tmux was that it defaulted to a small screen and would not
resize.  Here is a method to get around that. It requires booting into the
Desktop Gui instead of the console. This allows you to set the resolution
of the display. I was never able to figure out how to set the resolution of
the console display, but you can change the resolution of the Gui display.

FIrst in the raspi-config boot options set Desktop-Autologin as the Pi user.

Then edit /boot/config.txt
add the following three lines to force the Pi to think it has an HDMI
display of a certain size.

hdmi_force_hotplug=1
framebuffer_width=1900
framebuffer_height=1024

Make the width and height to match the size you want on the ipad.

and if the following line is present comment it out
dtoverlay=vc4-kms-v3d

Note that if you now attach it to a real display it will not work. You will
have to revert those changes when going back to a real display.
Actually it might work if the width and height are supported by the real
display, but in my case this was not true.

Now create a file
/home/pi/.config/autostart/terminator.desktop
with the following
[Desktop Entry]
Type=application
Name=Terminator
Exec=/usr/bin/terminator -f -e tmux

Now the Pi will boot, login automatically, and run tmux fullscreen.

Then you can ssh in as the Pi user and run tmux attach.


Bill

Reply via email to