#!/bin/sh

# xterm - Wrapper for standard "xterm" program
# License:  BSD-style (for this file only)
# Revision: 210329

export LANG=en_US.UTF-8
export LANGUAGE=$LANG

N=`getx11dim 2>/dev/null | sed "s|x.*||"`

if [ "@$N" == "@" ]; then
    if [ "@$DISPLAY" \!= "@" ]; then
        N=1024
    fi
fi

FTSIZE=14
FTNAME=LiberationMono
GEOMETRY="73x25"

if [ $N -ge 1024 ]; then FTSIZE=14; GEOMETRY="73x25"; fi
if [ $N -ge 1280 ]; then FTSIZE=17; GEOMETRY="75x25"; fi
if [ $N -ge 1400 ]; then FTSIZE=17; GEOMETRY="75x25"; fi
if [ $N -ge 1680 ]; then FTSIZE=18; GEOMETRY="80x25"; fi

# This needs more work. Presently, this wrapper doesn't support multi-
# word title strings.

ARGS="-fa $FTNAME -fs $FTSIZE -en utf-8 -geometry $GEOMETRY -rv +sb"
BASEPROG=$PRODTREE/xorg/bin/xterm.orig

if [ x"$1" == x-T ]; then
    $BASEPROG $ARGS $*
else
    $BASEPROG -T xterm $ARGS $*
fi

# Note: Possible font choices include:
#
#     DejaVuSansMono
#     LiberationMono    - Best for XTerm purposes
#     LuxiMono          - Good for XTerm purposes, but bright
#     VeraMono
