#!/bin/zsh --
# open a terminal. keep options constant even if we change the underlying
# terminal.
#
# 2007/05/10 Azundris init
# 2007/05/15 Azundris fixes, mlterm
# 2007/05/17 Azundris fixes, initial xiterm
export LC_CTYPE=de_DE.UTF-8
if [ "x$DISPLAY" = "x" ]
then
. ~/.display
if [ "x$DISPLAY" = "x" ]
then
export DISPLAY=":0"
fi
fi
# defaults
WHATTERM=urxvt
GEO=80x40+48+200
EXC=$SHELL
TITLE_FLAG=0
if [[ "x$1" = "x-h" || "x$1" = "x-help" ]]
then
$0 --help
exit 0
fi
# process parameters
while [[ "$#" -gt 0 ]]
do
case "$1" in
--type) shift; WHATTERM=$1; shift;;
--help) echo "$0 [--title
] [--geometry x[++]] [--exec []]"; echo "if --exec is used, it must be given as last argument."; exit 0;;
--exec) EXC=""; shift; break;;
--geometry) shift; GEO=$1; shift;;
--title) shift; TITLE=$1; TITLE_FLAG=1; shift;;
*) echo "unknown option \"$1\"!?"; exit 1;;
esac
done
if [ $TITLE_FLAG -eq 0 ]
then
TITLE=$WHATTERM
fi
C=`echo $GEO|sed -e's/\([0-9][0-9]*\)x.*/\1/g'`
L=`echo $GEO|sed -e's/[0-9]*x\([0-9][0-9]*\).*/\1/g'`
# echo "GEO |$GEO| (${C}x${L}); TITLE |$TITLE|; EXEC |$EXC|; REST |$*|"
#exit
# must start with & so we release the shell executing this script
case $WHATTERM in
# Hebrew glyphs, but no RTL
gnome*) gnome-terminal --geometry=$GEO -t "$TITLE" -x $* $EXC & ;;
# Hebrew glyphs, but no RTL
urxvt) urxvt -pe -option-popup,-selection-popup,-searchable-scrollback,-readline,-tabbed,mark-urls,selection-autotransform,selection -geometry $GEO +sb -depth 32 -bg rgba:0000/0000/0000/cccc -fg "gray99" -fn "xft:DejaVu Sans Mono:pixelsize=20" -fi "xft:DejaVu Sans Mono Oblique:pixelsize=20" +bc +vb -sl 0 -tn vt100 -title "$TITLE" -e $* $EXC & ;;
# -default,selection,selection-autotransform,mark-urls,block-graphics-to-ascii,remote-clipboard
# Hebrew glyphs and RTL
# needs work, my --type=xft / --aa breaks Hebrew glyps. no alpha.
mlterm) mlterm --im=xim --fg=white --bg=black --geometry=$GEO --stbs=true --bel=sound --fontsize=20 --aa=true --sbbg=black --bi=true "--title=$TITLE" --type=xft -e $* $EXC & ;;
# Hebrew glyphs and RTL
# needs work, my -fn breaks Hebrew glyps. no xft, no alpha.
xiterm) xiterm -fg white -bg black -fn "-misc-dejavu sans mono-medium-r-normal-*-0-0-0-0-m-0-iso10646-1" & ;;
# Hebrew glyphs, but no RTL
konsole) konsole --vt_sz ${C}x${L} -T "$TITLE" --real-transparency --noscrollbar --noframe --nomenubar --notabbar --nohist -e $* $EXC & ;;
*) echo "unknown terminal \"$WHATTERM\"";;
esac