/screen-session

screen-session ( aka scs ) is a collection of tools for GNU Screen. It includes a session saver and a session manager, among others.

Primary LanguageC

screen-session - a collection of tools for GNU Screen
=====================================================

Website: http://skoneka.github.com/screen-session/

Development: git clone git://github.com/skoneka/screen-session


-----------------------------------------------------------------------
Description
-----------------------------------------------------------------------
screen-session is a collection of tools for GNU Screen.
It includes a session saver and a session manager, among others.

online documentation is available at:
http://skoneka.github.com/screen-session/documentation.html

Available screen-session modes:

----
save              - save Screen ( and VIM ) session
load              - load session
ls                - list saved sessions
----

dump              - print detailed informations about windows in the session
group             - move windows to a group
layoutlist        - display a list of layouts
layout-checkpoint - record a snapshot of the current layout.
layout-history    - display saved snapshots of the current layout
layout-redo       - load a snapshot of the current layout,
layout-undo       - load a snapshot of the current layout,
layout-zoom       - zoom into and out of a region
kill              - send SIGTERM to last the process started in a window
kill-zombie       - kill all zombie windows in the session
kill-group        - recursively kill all windows in a group
manager           - sessions manager (screenie like) but featuring session
                    preview in a split window
nest-layout       - copy a layout to the current region
new-window        - start a new Screen window in the same working directory
                    on the position next to the current window
name              - get or set the sessionname
regions           - display a number in every region (like tmux display-panes)
renumber          - renumber windows to fill gaps
subwindows        - recursively print windows contained in groups


-----------------------------------------------------------------------
Installation and Requirements
-----------------------------------------------------------------------
see INSTALL


-----------------------------------------------------------------------
Running screen-session
-----------------------------------------------------------------------
run "screen-session help" and "screen-session help [MODE]" for detailed
examples


-----------------------------------------------------------------------
A Detailed Description of Session Saver
-----------------------------------------------------------------------
Session saver currently supports saving of:
layouts, scrollbacks, titles, filters and is able to restart programs
run in windows. It recognizes regular, group and zombie windows.
Currently there is no support for serial and telnet window types.
By default, session saver also tries to save Vim sessions using ":mksession"
and ":wviminfo".

Session saver accesses important data by directly reading /proc filesystem 
and sorts processes by parent pid. There is almost no "stuffing" of commands 
into windows (except when saving Vim sessions) so there is no interaction 
with programs itself.

During session loading, every new window starts with screen-session-primer
(a small C program) which displays a list of processes and asks user what
to do: whether to start none, some or all of window's processes or directly
starts programs provided "--force-start [win_num]" option was used.

Then, primer tries to restore the string of processes by executing
for nodes:
$ shell -ic "primer_start-program ID-of-a-process-to-be-started \
IDs-of-queued-programs; primer_start-program ID-of-the-shell" shell-arguments
(during resaving the "-ic arguments" part is ignored)

And for the last process to be restored:
$ primer_start-program ID-of-a-process-to-be-started

primer_start-program reads the process data from savefile/win_NUM and calls
execvp() function.

Primer is capable of restoring an arbitrary number of processes, provided
that all intermediate nodes are shells which accept the '-c command' switch.

May be restored completely:
0 zsh -> 1 bash -> 2 vim hello.c

Only up to 1:
0 zsh -> 1 man hello -> 2 less

screen-session-primer uses linux color escapes.
To disable color remove "-DCOLOR" from config.mk

Normally screen-session does not restore exact window numbers. If you
want to force verbatim restoring use --exact or --exact-kill flags.

Save files are .tar.bz2 archives (scrollbacks can take a lot of space).
Temporary files are stored in  /tmp/screen-session-$USER.
You may edit save files either by typing 'E' in a primer instance or with
the "other" mode: $ screen-session other [ --unpack | --pack ] savefile
which unpacks the savefile to the temporary directory and symlinks it to
$HOME/.screen-sessions/ directory.


-----------------------------------------------------------------------
Bugs
-----------------------------------------------------------------------

* Tools using layouts may fail if operating on detached Screen sessions.
* Some scripts do not work properly if there is more than 1 client attached.
* Saver is incapable of properly saving other user's (or SUID) processes
* In order to speed up Screen commands execution :msgminwait is set to 0
  and the original value is not restored.
* :hardcopydir is altered and not restored properly

Please send suggestions and bug reports to Github issue tracker:
http://github.com/skoneka/screen-session/issues