#!/bin/bash -x # gt-screen - using screen within gnome-terminal (or at least that was the # original idea). ############################################################################### ### Configuration ############################################################# ############################################################################### CONFIG_DIR=$HOME/.config/screen BASENAME=gt-screen ############################################################################### ### main () ################################################################### ############################################################################### if [ "x$1" != "x" ]; then NAME=$1 else NAME=$BASENAME fi if [ -f "$CONFIG_DIR/$NAME" ]; then CONFIG="$CONFIG_DIR/$NAME" else CONFIG="$CONFIG_DIR/default" fi SCREEN="screen -c $CONFIG -S $NAME" ID="$2" if [ "x$ID" == "x" ]; then exec $SCREEN -xRR $NAME fi PID=`$SCREEN -list | grep tached | head -1 | awk -F. ' { print $1 }'` if [ "x$PID" == "x" ]; then $SCREEN -d -m PID=`$SCREEN -list | grep tached | head -1 | awk -F. ' { print $1 }'` fi SCREEN_RUN="screen -xR $PID" if [ "x$3" != "x" ]; then $SCREEN_RUN -X screen -T rxvt -t $ID 1 $3 $4 $5 $6 $7 $8 $9 fi exec $SCREEN_RUN -p $ID ############################################################################### ### Documentation ############################################################# ############################################################################### # Documentation. Use a hack to hide this from the shell. Because of the # above exit line, this should never be executed. DOCS=<<__END_OF_DOCS__ =head1 NAME gt-screen - use screen within gnome-terminal =head1 SYNOPSIS B I B I I B I I I =head1 DESCRIPTION gt-screen is a script to manipulate groups of screens, for use in a windowed environment (and originally within gnome-terminal itself). =head1 USAGE =over 4 =item B I Creates a new screen group named I and connects to it. =item B I I Connects to the existing window I in the screen I. =item B I I I Creates a new window I within the screen I, and runs I in it. =back =head1 FILES =over 4 =item B<~/.config/screen/*> Configuration files for the screens. If there is a file named I, then we will create new screen sessions with that config file. =item B<~/.config/screen/default> Default configuration file. =back =head1 SEE ALSO screen(1) =head1 AUTHOR Tim Skirvin =cut __END_OF_DOCS__