##*************************************
##
## E.S.O. - VLT project
##
## "@(#) $Id: Vueprofile,v 1.25 1999/05/09 22:46:23 vltsccm Exp $"
##
## Vueprofile"
## 
## who      when     what
##-------- -------- ------------------
##vltsccm 02/16/95 created for cmm
##
#-------------------------------------------------------------------------------
# E.S.O. VLT Project
#
# Vueprofile
#
#    VUE Window Manager login file.
#    (modified according to VLT standardization on SUN AND HP)
#
# who        when      what
# ---------  --------  ----------------------------------------------
# GIF        16/08/93  created modifying original HP file
# GIF        11/10/93  EAL -> forced /bin/csh because VUE does not accept tcsh
# GIG        03/11/93  te16 added to xhost list
# GIF        05/11/93  te13 added to xhost list
# GIF        04/02/94  te27 added to xhost list
# PFO        30/08/94  standardized xhost list                     
# PFO        04/11/94  Added ALT key handling (GCH contribution).
# ---1.5-----
# PFO        23/02/95  Enabled xauth-style authorization
# EAL        18/07/97  Converted to (k)sh syntax, so it does get executed

###>>> The following lines up to the next ">>>"are the original file by HP

#############################################################################
###
###  .vueprofile
###
###  HP VUE user personal customizations script
###
###  @(#)Hewlett-Packard Visual User Environment, Version 3.0
###  Copyright (c) 1992, 1993, 1994 Hewlett-Packard Company
###
###  $Revision: 1.25 $
###  ______________________________

###  This file is a template for $HOME/.vueprofile, the user's personal
###  VUE session customization script.  Commands in .vueprofile must
###  conform to either sh or ksh syntax, and content should be limited
###  to setting environment variables and starting pre-session background
###  clients.  The .vueprofile script should not contain any commands
###  that perform terminal I/O.

###  The user should be aware that $HOME/.vueprofile is sourced by
###  /etc/vue/config/Xsession prior to any and all Xsession.d scripts
###  and invocation of the actual session startup mechanism.  Commands
###  placed in .vueprofile can potentially influence Xsession.d script
###  behavior and session startup.

###
###  ENVIRONMENT VARIABLES
###  ---------------------
###  The following list describes VUE environment variables which are
###  defined when $HOME/.vueprofile is executed.  Unless otherwise
###  indicated, all of these variables will appear in the session's
###  initial environment.  See VUE on-line help, the VUE Users Guide,
###  or the Vuelogin(1X) man page for details on setting environment
###  variables.

###    DISPLAY      set to the value of the first field in the Xservers file
###    EDITOR	     set to the HP VUE default editor
###    ENV          set to "$HOME/.kshrc"
###    HOME	     set to the user's home directory (from /etc/passwd)
###    KBD_LANG     set to the value of $LANG for certain languages
###    LANG	     set to the display's current NLS language (if any)
###    LOGNAME      set to the user name
###    MAIL	     set to "/usr/bin/mail/$USER"
###    MANPATH      set to the value of the Vuelogin "manPath" resource
###    PATH	     set to the value of the Vuelogin "userPath" resource
###    SESSION_SVR  set to the name of the session server (`uname -n`)
###    SHELL	     set to the user's default shell (from /etc/passwd)
###    TERM	     set to "xterm"
###    TZ	     set to the value of the Vuelogin "timeZone" resource
###    USER	     set to the user name

###
###  STARTUP CONTROL VARIABLES
###  -------------------------
###  This list describes Xsession control variables which may be defined,
###  tested, or modified by $HOME/.vueprofile.
###
###    SESSIONTYPE        "xdm", "vuelite", "vue", or undefined
###                       This variable is defined only if the user has
###                       explicitly selected a session type from the login
###                       [options] menu, or if either of the two resources
###                       "Vuelogin*xdmMode" or "Vuelogin*vuelite" is set
###                       to "true".
###
###    VUE_IMS_PID        Undefined
###                       VUE_IMS_PID is a simple, suggested mechanism for
###                       controlling the startup of an Input Method Server.
###                       A .vueprofile or Xsession.d script that plans to
###                       start an Input Method Server should first test
###                       if the variable VUE_IMS_PID exists.  If it has
###                       already been defined, it indicates that an IMS
###                       process has already been started, and a new one
###                       should not be started; if does not exist, an IMS
###                       may be started, and VUE_IMS_PID should be set to
###                       its process id (or "0" if the pid is unavailable).
###
###    VUETERM            "/usr/vue/bin/hpterm"
###                       This variable should specify a terminal emulator
###                       which will be run as a last resort if no other
###                       startup mechanism is available.  This variable is
###                       also exported into the session's environment,
###                       where it may be referenced, for example, in a
###                       Vue action to start a "preferred" terminal.
###
###    VUESOURCEPROFILE   Undefined
###                       See "Using Login Profile Scripts" below.
###
###    VUE_START_LOG      "$HOME/.vue/startlog"
###                       File in which to log session startup information.
###                       Complex .vueprofile and Xsession.d scripts may
###                       want to append activity messages to this file
###                       to aid in locating problems in the event that
###                       Vue should fail to start.

###    VUE_CONFIG_PATH    "/etc/vue/config"
###                       List of directories in which to search for
###                       Xsession.d subdirectories.

###    VUE_HELP_PATH      Undefined.
###                       List of directories in which to search for
###                       help files.  Generally, you should only append
###                       additional directory names to this list.

###
###  USING LOGIN PROFILE SCRIPTS
###  ---------------------------
###  Login profile scripts $HOME/.profile, and $HOME/.login are normally
###  not used by VUE as they often contain terminal-I/O-based commands
###  which could cause problems with a non-terminal, graphical interface.
###  However, you may force $HOME/.profile (sh/ksh users) or $HOME/.login
###  (csh users) to be run by setting the following environment variable
###  in .vueprofile:
###
###      VUESOURCEPROFILE="true"
###
###  If you plan to source your .profile or .login script, you should first
###  modify it so that it can be used in both VUE and non-VUE environments
###  by enclosing VUE-only and non-VUE-only commands in "if" blocks that
###  test the variable "$VUE".  If the script is run by VUE, the environment
###  variable $VUE will be defined as "true"; if the script is run by a
###  character-based login, $VUE will not be defined.  For example:
###
###      if [ ! "$VUE" ]; then
###
###        #  Commands and environment variables used when logging
###        #  into a non-VUE session

###        stty ...
###        tset ...
###	    DISPLAY=mydisplay:0
###        MAIL=/usr/bin/mail/$USER
###        EDITOR=/usr/bin/vi

###      fi
###
###      #  Commands and variables common to both VUE and non-VUE sessions
###
###      PATH=$HOME/bin:$PATH
###
###  Each new user's initial .vueprofile contains a block of commands
###  which examines the login profile script and automatically sets
###  VUESOURCEPROFILE to "true" if the script appears to be VUE safe
###  (i.e., it contains non-comment references to "VUE").  Users who
###  do not want this automatic behavior should delete, comment out,
###  or otherwise disable that portion of .vueprofile.
###
###  (NOTE: If you want to use vi or emacs command-line editing under ksh
###  in a VUE session terminal window, EDITOR should be defined among the
###  variables common to both VUE and non-VUE, rather than in the block of
###  non-VUE commands.  VUE normally defines EDITOR=/usr/vue/bin/vuepad.)
###
###
###  TROUBLESHOOTING
###  ---------------
###  An error in an Xsession.d script, .vueprofile, .profile, or .login may
###  prevent a successful session startup.  If you suspect such a problem,
###  log in using the [Fail-safe Session] option.  By examining the file
###  $HOME/.vue/startlog you may be able to determine the location of the
###  the problem.  $HOME/.vueprofile is sourced before Xsession.d scripts,
###  which are then sourced before executing the main session client
###  (usually vuesession).  If the last line of the startlog indicates that
###  the session client is being executed, but Vue still does not start,
###  check for problems in your login profile script (if used).  Refer to
###  the Vuelogin(1X) and Vuesession(1X) man pages for more information
###  about session startup.
###
#############################################################################

# Check if login script contains non-comment references to "VUE".
# If it does, assume it's VUE safe, and set VUESOURCEPROFILE to "true".

if [ "${SHELL:-}" -a -d "${HOME:-}" ]; then
  case ${SHELL##*/} in
    sh | ksh ) shellprofile="$HOME/.profile" ;;
         csh ) shellprofile="$HOME/.login" ;;
           * ) shellprofile="" ;;
  esac
  if [[ -r "$shellprofile" ]] ; then
    [ `grep -c '^[^#:].*VUE' $shellprofile` != 0 ] && VUESOURCEPROFILE="true"
  fi
fi

# Place customization code beyond this point.

###>>> End of the original file provided by HP and beginning of modification:

#
# VUE apparently adds $HOST, localhost and the display-host to the xhost table;
# remove these entries
for hostname in `xhost | sed 1d` ; do 
     xhost -$hostname
done

# Enable access control
xhost -

#
# system wide application default (mainly for compatibility with SUN te1)
XAPPLRESDIR=/vlt/System/X11/app-defaults/
export XAPPLRESDIR


# To enable the ALT key on Envizex
xmodmap -e 'remove mod1 = Mode_switch'
xmodmap -e 'add mod1 = Alt_R'
xmodmap -e 'add mod1 = Alt_L'
xmodmap -e 'keysym Alt_R = Alt_R Meta_R'

# Process the user local file, if any
if [[ -r "$HOME/.vueprofile.local" ]] ; then
    . $HOME/.vueprofile.local
fi

# ___oOo___
