From 01db6fccd450e2c7d6f3f8fe98231f2691e81d9b Mon Sep 17 00:00:00 2001 From: heinzel Date: Fri, 13 Jul 2001 14:35:28 +0000 Subject: [PATCH] added xtermmaker.sh (Version 3.1) Opens a given number of colored xterms (I became very famous by this script). Version 3.1 is a major rewrite of the Version 2.1. The versions till 2.1 were not in cvs. --- xtermmaker.sh | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 xtermmaker.sh diff --git a/xtermmaker.sh b/xtermmaker.sh new file mode 100755 index 0000000..87cc907 --- /dev/null +++ b/xtermmaker.sh @@ -0,0 +1,132 @@ +#!/bin/bash +# LOC ~/scripts/xtermmaker.sh +# CVS $Id: xtermmaker.sh,v 1.1 2001/07/13 14:35:28 heinzel Exp $ +version='xtermmaker.sh Version 3.1 $Revision: 1.1 $ ($Date: 2001/07/13 14:35:28 $ $Author: heinzel $)' + +### config ### +xterm=xterm +xterm_opts="-sb -sl 1024" + +number=1 +max_number=9 + +rsh=ssh +host="" +user="" + +color=BUNT +theme=light +themes="traditional, light" + +# Note: Themes must have $max_number colors defined +theme_traditional="SteelBlue,SeaGreen,orange,gold,tomato,CadetBlue,SlateGrey,MediumSeaGreen,Goldenrod" + +theme_light="SlateGrey,MediumSeaGreen,Goldenrod,IndianRed,CadetBlue,MediumSeaGreen,Goldenrod,SlateGrey,IndianRed" + +### functions ### +show_version() +{ + echo $version +} + +show_help() +{ + echo "Usage: xtermmaker.sh [-n ] [-u ] [-r ]" + echo " [-c ] [-g] [-b] [--t ]" + echo " [-h|--help] [-V|--version]" + echo "" + echo "-n opens xterms (default: $number) (max: $max_number)" + echo "" + echo "-r exec remote shell to the specified hostname" + echo "-u specified the username for the remote host" + echo "" + echo "-c set the backgroundcolor of the xterms" + echo "-g same as -c Gray" + echo "-b generates \"Bunte XTerms\" (default)" + echo "-t use color theme for \"Bunte XTerms\"" + echo " possible themes: $themes (default: $theme)" + echo "" +} + + +### argv ### + +# read arguments from stdin +while test $# -gt 0 ; do + case "$1" in + -h|-help|--help) + show_help + exit 0 + ;; + -V|-version|--version) + show_version + exit 0 + ;; + -n|-number|--number) + number="$2" + shift + shift + ;; + -c|-color|--color) + color="$2" + shift + shift + ;; + -g) + color=Gray + shift + ;; + -b) + color=BUNT + shift + ;; + -t|-theme|--theme) + theme="$2" + shift + shift + ;; + -u|-user|--user) + user="$2" + shift + shift + ;; + -r|-host|--host) + host="$2" + shift + shift + ;; + esac +done + +### action ### + +test "$number" || number=1 + +count=1 +until test $count -gt $number ; do + + title_opt="-title $count" + + if test "$color" = "BUNT" ; then + eval colors=\$theme_$theme + bg_opt="-bg `echo $colors | cut -f $count -d ,`" + else + bg_opt="-bg $color" + fi + + fg_opt="-fg black" + + pos_opt="" + + if test "$host" ; then + t=$host + test "$user" && t="${user}@${host}" + exec_opt="-e $rsh $t" + fi + + $xterm $xterm_opts $title_opt $bg_opt $fg_opt $pos_opt $exec_opt & + + count=`expr $count + 1` +done + +exit 0