source: trunk/debathena/debathena/dotfiles/xsession.bash @ 23823

Revision 23823, 8.0 KB checked in by geofft, 15 years ago (diff)
In dotfiles: * Don't run 'from' on EXCHANGE.MIT.EDU accounts for now. This is apparently causing prefrosh' dotfiles to hang forever on login.
RevLine 
[22966]1#!/bin/athena/bash --norc
2# Global xsession file for bash users
3# Accepts one optional argument, either "nocalls" (use no user files)
4# or "dash" (use old dash-based interface).
5#
6# $Id: xsession.bash,v 1.1 2008-05-08 18:02:32 ghudson Exp $
7
8initdir=/usr/lib/init
9gconftool=/usr/bin/gconftool-2
10
11source_if_exists() {
12  [ -r "$1" ] && . "$1"
13}
14
15echo_if_verbose() {
16  [ t = "$verbose_login" ] && echo "$@"
17}
18
19# Determine whether to use user customizations:  use no customization files
20# ONLY if the single argument "nocalls" was provided to xsession (e.g., if
21# the user selected the "Ignore your customizations" option from the
22# initial xlogin menu).
23
24case $# in
250)
26  ;;
271)
28  if [ nocalls = "$1" -o x-nocalls = "x$1" ]; then
29    echo -n "xsession: Running standard xsession "
30    echo "with NO user configuration files..."
31    export NOCALLS=
32  elif [ dash = "$1" ]; then
33    echo -n "xsession: Running standard xsession "
34    echo "with dash-based interface..."
35    export ATHENA_DASH_INTERFACE=t
36  else
37    bad_args=
38  fi
39  ;;
40*)
41  bad_args=t
42  ;;
43esac
44
45if [ t = "$bad_args" ]; then
46  echo "xsession: Arguments ($*) not recognized."
47  echo "Running standard xsession with user configuration files..."
48  unset NOCALLS
49  unset bad_args
50fi
51
52# Echo messages unless user has ~/.hushlogin file AND the session was not
53# started using the xlogin "SYSTEM" option.
54
55if [ ! -r "$HOME/.hushlogin" -o "${NOCALLS+set}" = set ]; then
56  verbose_login=t
57fi
58
59# Use old dash-based interface if the user has
60# ~/.athena_dash_interface and the session was not started with
61# NOCALLS.
62
63if [ -r "$HOME/.athena_dash_interface" -a "${NOCALLS+set}" != set ]; then
64  export ATHENA_DASH_INTERFACE=
65fi
66
67# *******************   ENVIRONMENT SETUP   *******************
68
69
70# Identify this as a window session.
71
72export XSESSION=$$
73
74# The ~/.bashrc file sets environment variables, attaches lockers, and sets
75# the command search path.
76
77echo_if_verbose "Setting up environment..."
78
79# Source the system startup scripts if necessary.
80source_if_exists /etc/profile
81source_if_exists /etc/bashrc
82source_if_exists /etc/bash.bashrc
83
84if [ "${NOCALLS+set}" = set ]; then
85  source_if_exists "$initdir/bashrc"
86else
87  if [ -r "$HOME/.bashrc" ]; then
88    . "$HOME/.bashrc"
89  else
90    source_if_exists "$initdir/bashrc"
91  fi
92fi
93
94if [ "${ATHENA_DASH_INTERFACE+set}" = set ]; then
95  default_windowmanager=mwm
96  terminal='xterm -geometry 80x48+0+38'
97else
98  default_windowmanager=metacity
99  terminal='gnome-terminal --geometry=80x40-0-52'
100
101  # GNOME processes can apparently collide trying to start gconfd, so
102  # spawn one before we start any in the background.
103  $gconftool --spawn
104fi
105
106
107# *******************   DEVICE SETUP   *******************
108
109# Load user X resources.
110
111if [ "${NOCALLS+set}" != set -a -r "$HOME/.Xresources" ]; then
112  xrdb -merge ~/.Xresources
113fi
114
115
116# *******************   ACTIVITY STARTUP   *******************
117
118# Start window manager.  To change your default window manager, set the
119# WINDOW_MANAGER environment variable in your ~/.bash_environment file.
120if [ "${WINDOW_MANAGER+set}" != set ]; then
121  if [ -r "$HOME/.athena-sawfish" ]; then
122    export WINDOW_MANAGER=sawfish
123  else
124    export WINDOW_MANAGER=$default_windowmanager
125  fi
126fi
127
128echo_if_verbose "Starting $WINDOW_MANAGER window manager..."
129
130if [ "${NOCALLS+set}" = set ]; then
131  (metacity >/dev/null 2>&1 &)
132else
133  ($WINDOW_MANAGER >/dev/null 2>&1 &)
134fi
135
136# Run standard system/user startup activities
137
138if [ "${ATHENA_DASH_INTERFACE+set}" != set ]; then
139  # Run gnome-settings-daemon unless the user has chosen to skip it.
140  # (We used to run a series of capplets with an init flag; thus the
141  # skip variable is named skip_capplets.)
142  if [ "${skip_capplets+set}" != set ]; then
143    echo_if_verbose "Initializing settings..."
144
145    # This incantation causes gnome-settings-daemon to be run via
146    # Bonobo, such that we won't continue until the settings-daemon
147    # object has been initialized and all settings have been
148    # propagated.  If we just naively run gnome-settings-daemon in the
149    # background, settings may not propagate before GNOME programs
150    # run.  In particular, GNOME programs might render text before the
151    # Xft settings have been propagated, leading to incorrect font
152    # selection.
153    activation-client -s "iid == 'OAFIID:GNOME_SettingsDaemon'" >/dev/null
154  fi
155
156  # Run the GNOME panel unless the user has chosen to skip it.
157  if [ "${skip_panel+set}" != set ]; then
158    echo_if_verbose "Starting panel..."
159    (gnome-panel >/dev/null 2>&1 && kill -HUP "$XSESSION" &)
160  fi
161
162  # If you decide to set skip_nautilus, GNOME will stop taking care
163  # of your background image unless you run:
164  #   gconftool-2 -s -t bool /apps/nautilus/preferences/show_desktop false
165  if [ "${skip_nautilus+set}" != set ]; then
166    (nautilus -n >/dev/null 2>&1 &)
167  fi
168
169elif [ "${skip_dash+set}" != set ]; then
170  if [ "${skip_xlogout+set}" != set ]; then
171    echo_if_verbose "Starting the Athena Dashboard..."
172    echo_if_verbose "Creating logout button..."
173    (dash -default -logout &)
174  else
175    echo_if_verbose "Starting the Athena Dashboard..."
176    (dash &)
177  fi
178elif [ "${skip_xlogout+set}" != set ]; then
179  echo_if_verbose "Creating logout button..."
180  (dash -logout &)
181fi
182
183# Start default initial xterm window.  To skip this, put the command
184# "skip_initial_xterm=t" in your ~/.bash_environment file.
185
186# BE CAREFUL:  If you skip this, make sure that your ~/.startup.X file
187# provides a way for you to exit your session (e.g., an xterm from which
188# you can type "logout").
189
190if [ "${skip_initial_xterm+set}" != set ]; then
191  echo_if_verbose "Creating initial xterm window..."
192  ($terminal >/dev/null 2>&1 &)
193fi
194
195# Run default system startup activities.  To skip these, put the command
196# "skip_x_startup=t" in your ~/.bash_environment file.
197
198if [ "${skip_x_startup+set}" != set ]; then
199  echo_if_verbose "Running standard startup activities..."
200
201  # Start Zephyr client, and if zephyr started okay, send message of
202  # the day as windowgram
203  : ${ZEPHYR_CLIENT=zwgc}
204  if [ "${NOCALLS+set}" = set ]; then
205    zwgc -f /etc/zephyr/zwgc.desc -subfile /dev/null && \
206      get_message -new -zephyr
207  else
208    $ZEPHYR_CLIENT && get_message -new -zephyr
209  fi
210  if [ "${skip_quotawarn+set}" != set ]; then
211    ($initdir/quotawarn &)      # Display warning dialogs if near quota
212  fi
[23823]213  if hesinfo "$USER" pobox | grep -qv EXCHANGE; then
214    from -t -n                  # Check for mail
215  fi
[22966]216  if [ "${skip_xss+set}" != set ]; then
217    (xscreensaver -no-splash &)
218  fi
219  if [ "${skip_authwatch+set}" != set ]; then
220    (authwatch &)
221  fi
222fi
223
224# Maybe start the Disco-Athena daemon.
225if [ -r /var/run/athstatusd.sock -a "${skip_athneteventd+set}" != set ]; then
226  athneteventd
227fi
228
229# Run the window-session customizing commands in your ~/.startup.X
230# file.  We want to background this process in case something in the
231# startup hangs.  Thus, the user will not be left with active windows
232# and no method of easily logging out.
233
234# We also run the notification system, lert. Ideally, we wish the user
235# to receive the alert in the form of a zephyrgram, and since they may
236# run zwgc from their .startup.X, we wait until that has finished.  To
237# skip lert (a generally bad idea unless you plan to run it yourself -
238# it is not at all intended for frivolous messages), put the command
239# "skip_lert=t" in your ~/.bash_environment file.
240
241if [ "${NOCALLS+set}" != set -a -r "$HOME/.startup.X" ]; then
242  echo_if_verbose "Running custom startup activities listed in ~/.startup.X..."
243  ( . "$HOME/.startup.X"; \
244    if [ "${skip_lert+set}" != set ]; then lert -q -z; fi; \
245    echo_if_verbose "Session initialization completed." &)
246else
247  if [ "${skip_lert+set}" != set ]; then
248    lert -q -z
249  fi
250  echo "Session initialization completed."
251fi
252
253
254# Gate the session.
255
256# This command replaces this script and will wait for you to log out.
257# To terminate this process, logout (type the "logout" command in any
258# xterm window, use the Logout button, or select the "Logout of
259# Athena" option from Dash), or invoke the "end_session" program.
260
261if [ "${NOCALLS+set}" = set ]; then
262  exec session_gate
263else
264  exec session_gate -logout
265fi
266
267# The session gate will source .logout when it gets a SIGHUP, if
268# invoked with the -logout flag.
Note: See TracBrowser for help on using the repository browser.