4

I'm wondering if there is some way to create a heirarchy/tree of terminals in a screen session on Linux?

I don't mind hacking on this, so if there is a project out there that's working on this, I'd like to get involved with it.


Explanation:

I'd like to have something like

1 bash
  1.1 bash
  1.2 bash 2 bash 3 bash
  3.1 bash
    3.1.1 bash
    3.1.2 bash

It would be good if the terminals could be labelled instead of having to be navigated to via some arrangement that I suspect doesn't exist. So then you could jump to one using eg ^A:goto happydays or ^A:goto dykstra.angry.

Every browser offers the ability to create a flat set of tabs containing documents of an identical nature. GNU-screen implements the same functionality without using tabs. Linux and OS/X window managers provide the ability to organize windows into an array of workspaces, which amounts to again, the same deal.

I'd like to be able to not only group things into a tree structure, but also to create references (aka symbolic links, aka pointers) from one part of the structure to another, as well as apply properties (eg default directory, colorscheme, ...) recursively downward from a given node.

intuited
  • 3,481

3 Answers3

1

Yanno, that sounds a lot like what Byobu can do

Journeyman Geek
  • 133,878
1

just found this question.

You can do what I believe you are looking for right inside gnu-screen. In .screenrc, add:

screen -t 1.1 0 # just a shell

screen -t 1.2 1 screen -m -e^xx-c ${HOME}/.screenrc-1.2 #new session inside accessed by Ctrl-x

screen -t 1.3 2 screen -m -e '^xx' -c ${HOME}/.screenrc-1.3 #yet another new session

Then the ~/.screenrc-1.2 and ~/.screenrc-1.3 could be separate setups for the subsessions; for example, .screenrc-1.3 could define more subsessions. Once inside the entire session, you can switch between them, and the inner sessions have their own control sequences (ctrl-x), you can navigate to the by name or number: select 1.2.

Arcege
  • 2,163
0

Nesting screen sessions (as suggested by Archege) will achieve what you're looking to do, but managing the multiple layers of nesting (especially when it comes to sending commands to the correct screen session) can be a pain. More recent versions of screen (I'm using 4.1.0) support window groups, which can do most of what you're looking to accomplish. Window groups don't seem to be capable of anything analogous to hardlinking, and the feature has only minimal integration and documentation (presumably due to being comparatively new and relatively obscure). However, a notable advantage of window groups is that they work through a single screen session; consequently, managing the nested arrangement is less troublesome.

The code block below is a commented copy/paste of the sections of my .screenrc that are relevant to window groups:

# first, make a root group that all of the other groups will go into
# note that the "//group" is *NOT* a comment; without it, only a
#  standard window will be spawned
screen -t root    0 //group

# select the root window to make sure that the next created group will
#  end up there, and make another group nested inside of it
select 0
screen -t shells  1 //group

# rinse and repeat for more groups
select 0
screen -t editors 2 //group
select 0
screen -t SSH     3 //group
select 0
screen -t scratch 4 //group
select 0
screen -t scripts 5 //group

# to add windows into first group, select it and then create windows
#  as normal
select 1
screen 6
screen 7

# rinse and repeat as desired for the other groups
select 2
screen 8
# and so on...