I’m ricing out my .screenrc to create my layouts for me and populate them with Windows. This way when I launch into screen, everything will be ready to go.
However, when you spawn bash into a Window and then create some layouts with the Window, your prompt (roughly) remembers the last position it was in, vertically. So if you create a vertical split layout before you create a horizontal one and then boot into the vertical layout, the prompt will be in the middle of your screen.
Pictures of the messed up vertical layout as well as the the last-created layout.
#initialize windows; try to clear them first
screen -t Alpha 1 bash -c "clear; exec bash"
screen -t Bravo 2 bash -c "clear; exec bash"
screen -t Keep 3 bash -c "clear; exec bash"
screen -t Log 4 bash -c "clear; echo 'Type Ctrl+A followed by Shift+? for help'; exec bash"
select 0
layout autosave on
layout new big
select 1
layout new vert_split
select 1
split -v
focus right
select 4
focus left
layout new tri_pane
select 1
split
resize -v +7
focus down
select 3
split -v
resize -h +10
focus right
select 4
focus up
#clearing them above doesn't work for all layouts, so clear after layout creation too
# both versions below are non-functional
screen -p 1 -X stuff 'date^M' screen -p 2 -X stuff 'date'
layout attach vert_split
layout select vert_split
I can send commands to detached screens from the cmdline by doing screen -S <id> -p 1 -X stuff 'date^M'
which works as expected. I suspect that the -p flag requires a -S flag, but I’m not sure how to get the id of the screen from the .rc file.
quizzicalspade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.