1 | #!/bin/athena/tcsh -f |
---|
2 | # Global xsession file |
---|
3 | # Accepts one optional argument, either "nocalls" (use no user files) |
---|
4 | # or "dash" (use old dash-based interface). |
---|
5 | # |
---|
6 | # $Id: xsession,v 1.7 2003-04-22 15:34:34 ghudson Exp $ |
---|
7 | |
---|
8 | # Note: This shell script deliberately uses the -f flag. |
---|
9 | |
---|
10 | set initdir=/usr/athena/lib/init |
---|
11 | |
---|
12 | # Determine whether to use user customizations: use no customization files |
---|
13 | # ONLY if the single argument "nocalls" was provided to xsession (e.g., if |
---|
14 | # the user selected the "Ignore your customizations" option from the |
---|
15 | # initial xlogin menu). |
---|
16 | |
---|
17 | switch ($#argv) |
---|
18 | case 0: |
---|
19 | breaksw |
---|
20 | case 1: |
---|
21 | if (($1 == nocalls) || ($1 == -nocalls)) then |
---|
22 | echo -n "xsession: Running standard xsession " |
---|
23 | echo "with NO user configuration files..." |
---|
24 | setenv NOCALLS |
---|
25 | setenv SHELL /bin/athena/tcsh |
---|
26 | else if ($1 == dash) then |
---|
27 | echo -n "xsession: Running standard xsession " |
---|
28 | echo "with dash-based interface..." |
---|
29 | setenv ATHENA_DASH_INTERFACE |
---|
30 | else |
---|
31 | set bad_args |
---|
32 | endif |
---|
33 | breaksw |
---|
34 | default: |
---|
35 | set bad_args |
---|
36 | endsw |
---|
37 | |
---|
38 | if ($?bad_args) then |
---|
39 | echo "xsession: Arguments ($argv) not recognized." |
---|
40 | echo "Running standard xsession with user configuration files..." |
---|
41 | unsetenv NOCALLS |
---|
42 | unset bad_args |
---|
43 | endif |
---|
44 | |
---|
45 | # Echo messages unless user has ~/.hushlogin file AND the session was not |
---|
46 | # started using the xlogin "SYSTEM" option. |
---|
47 | |
---|
48 | if ((! -r ~/.hushlogin) || ($?NOCALLS)) set verbose_login |
---|
49 | |
---|
50 | |
---|
51 | # Use old dash-based interface if the user has |
---|
52 | # ~/.athena_dash_interface and the session was not started with |
---|
53 | # NOCALLS. |
---|
54 | |
---|
55 | if (-r ~/.athena_dash_interface && ! $?NOCALLS) then |
---|
56 | setenv ATHENA_DASH_INTERFACE |
---|
57 | endif |
---|
58 | |
---|
59 | # ******************* ENVIRONMENT SETUP ******************* |
---|
60 | |
---|
61 | |
---|
62 | # Identify this as a window session. |
---|
63 | |
---|
64 | setenv XSESSION $$ |
---|
65 | |
---|
66 | # Create a unique temporary directory for the session, and remember |
---|
67 | # the directory name in the environment. |
---|
68 | set sessiondir = "`$initdir/mksessiondir -s $$`" |
---|
69 | if ("$sessiondir" != "") then |
---|
70 | setenv ATHENA_SESSION_TMPDIR "$sessiondir" |
---|
71 | endif |
---|
72 | |
---|
73 | # We set sleep_time to 0 for historical purposes, in case anyone has |
---|
74 | # code that depends on its value. |
---|
75 | |
---|
76 | set sleep_time=0 |
---|
77 | |
---|
78 | # The ~/.cshrc file sets environment variables, attaches lockers, and sets |
---|
79 | # the command search path. |
---|
80 | |
---|
81 | if ($?verbose_login) echo "Setting up environment..." |
---|
82 | |
---|
83 | # Source the system login if necessary. |
---|
84 | if (-r /etc/.login) source /etc/.login |
---|
85 | |
---|
86 | if ($?NOCALLS) then |
---|
87 | if (-r ${initdir}/cshrc) source ${initdir}/cshrc |
---|
88 | else |
---|
89 | if (-r ~/.cshrc) then |
---|
90 | source ~/.cshrc |
---|
91 | else |
---|
92 | if (-r ${initdir}/cshrc) source ${initdir}/cshrc |
---|
93 | endif |
---|
94 | endif |
---|
95 | |
---|
96 | if ($?ATHENA_DASH_INTERFACE) then |
---|
97 | set default_windowmanager=mwm |
---|
98 | set terminal='xterm -geometry 80x48+0+38' |
---|
99 | else |
---|
100 | set default_windowmanager=sawfish |
---|
101 | set terminal='gnome-terminal --geometry=80x48+0+30' |
---|
102 | endif |
---|
103 | |
---|
104 | |
---|
105 | # ******************* DEVICE SETUP ******************* |
---|
106 | |
---|
107 | # Load user X resources. |
---|
108 | |
---|
109 | if ((! $?NOCALLS) && (-r ~/.Xresources)) xrdb -merge ~/.Xresources |
---|
110 | |
---|
111 | |
---|
112 | # ******************* ACTIVITY STARTUP ******************* |
---|
113 | |
---|
114 | if ( ! $?NOCALLS && -d ~/.gnome && ! -d ~/.gnome2 ) set offer_gnome_upgrade |
---|
115 | |
---|
116 | # Start window manager. To change your default window manager, set the |
---|
117 | # WINDOW_MANAGER environment variable in your ~/.environment file. |
---|
118 | if (! $?WINDOW_MANAGER) setenv WINDOW_MANAGER $default_windowmanager |
---|
119 | |
---|
120 | if ($?verbose_login) echo "Starting $WINDOW_MANAGER window manager..." |
---|
121 | |
---|
122 | if ($?NOCALLS) then |
---|
123 | (sawfish --no-user-rc &) |
---|
124 | else |
---|
125 | ($WINDOW_MANAGER &) |
---|
126 | endif |
---|
127 | |
---|
128 | # Run standard system/user startup activities |
---|
129 | |
---|
130 | if ( -r ~/.athena_gnome_convert_failure ) |
---|
131 | # A previous attempt at converting GNOME preferences failed. Remove |
---|
132 | # any GNOME 2 preferences so that the user gets the defaults. |
---|
133 | gconftool-2 --recursive-unset /apps |
---|
134 | gconftool-2 --recursive-unset /desktop |
---|
135 | gconftool-2 --recursive-unset /system |
---|
136 | rm -rf ~/.gnome2 |
---|
137 | rm -f ~/.athena_gnome_convert_failure |
---|
138 | else if ($?offer_gnome_upgrade) then |
---|
139 | set dtext = ( \ |
---|
140 | "\n" \ |
---|
141 | " This Athena release uses GNOME 2, which changes the way the \n" \ |
---|
142 | " desktop is configured. You can attempt to convert your GNOME 1 \n" \ |
---|
143 | " preferences, or you can just accept the defaults for GNOME 2. \n" \ |
---|
144 | " If you do attempt to convert, you will be given a chance to go \n" \ |
---|
145 | " back to the defaults if it doesn't work well.\n" \ |
---|
146 | "\n" \ |
---|
147 | " Do you wish to attempt to convert your preferences?\n" ) |
---|
148 | if ( { gdialog --title "GNOME upgrade check" --yesno "$dtext" 9 70 } ) then |
---|
149 | touch ~/.athena-gnome-upgrade-log |
---|
150 | echo "Attempting GNOME upgrade on `date`" >> ~/.athena-gnome-upgrade-log |
---|
151 | sh $initdir/gnome-stuff-1-to-2 >>& ~/.athena-gnome-upgrade-log |
---|
152 | sh $initdir/gnome-panel-1-to-2 >>& ~/.athena-gnome-upgrade-log |
---|
153 | set offer_gnome_failure |
---|
154 | endif |
---|
155 | unset dtext |
---|
156 | endif |
---|
157 | |
---|
158 | if ( ! $?ATHENA_DASH_INTERFACE) then |
---|
159 | # Run the GNOME capplets unless the user has chosen to skip them. |
---|
160 | if (! $?skip_capplets) then |
---|
161 | if ($?verbose_login) echo "Initializing settings..." |
---|
162 | (gnome-settings-daemon &) |
---|
163 | endif |
---|
164 | |
---|
165 | # Run the GNOME panel unless the user has chosen to skip it. For |
---|
166 | # compatibility, if the user elected to skip both dash and xlogout |
---|
167 | # in the old dash-based world, skip panel now. TODO: deal with |
---|
168 | # NOCALLS; add logout confirmation |
---|
169 | if (! $?skip_panel && ! ($?skip_dash && $?skip_xlogout)) then |
---|
170 | if ($?verbose_login) echo "Starting panel..." |
---|
171 | (gnome-panel >& /dev/null && kill -HUP $XSESSION &) |
---|
172 | endif |
---|
173 | else if (! $?skip_dash) then |
---|
174 | if (! $?skip_xlogout) then |
---|
175 | if ($?verbose_login) echo "Starting the Athena Dashboard..." |
---|
176 | if ($?verbose_login) echo "Creating logout button..." |
---|
177 | (dash -default -logout &) |
---|
178 | else |
---|
179 | if ($?verbose_login) echo "Starting the Athena Dashboard..." |
---|
180 | (dash &) |
---|
181 | endif |
---|
182 | else if (! $?skip_xlogout) then |
---|
183 | if ($?verbose_login) echo "Creating logout button..." |
---|
184 | (dash -logout &) |
---|
185 | endif |
---|
186 | |
---|
187 | # Start default initial xterm window. To skip this, put the command |
---|
188 | # "set skip_initial_xterm" in your ~/.environment file. |
---|
189 | |
---|
190 | # BE CAREFUL: If you skip this, make sure that your ~/.startup.X file |
---|
191 | # provides a way for you to exit your session (e.g., an xterm from which |
---|
192 | # you can type "logout"). |
---|
193 | |
---|
194 | if (! $?skip_initial_xterm) then |
---|
195 | if ($?verbose_login) echo "Creating initial xterm window..." |
---|
196 | ($terminal >& /dev/null &) |
---|
197 | endif |
---|
198 | |
---|
199 | # Run default system startup activities. To skip these, put the command |
---|
200 | # "set skip_x_startup" in your ~/.environment file. |
---|
201 | |
---|
202 | if (! $?skip_x_startup) then |
---|
203 | if ($?verbose_login) echo "Running standard startup activities..." |
---|
204 | # Start Zephyr client, and if zephyr started okay, send message of |
---|
205 | # the day as windowgram |
---|
206 | if (! $?ZEPHYR_CLIENT) setenv ZEPHYR_CLIENT zwgc |
---|
207 | if ($?NOCALLS) then |
---|
208 | zwgc -f /usr/athena/share/zephyr/zwgc.desc -subfile /dev/null && \ |
---|
209 | get_message -new -zephyr |
---|
210 | else |
---|
211 | $ZEPHYR_CLIENT && get_message -new -zephyr |
---|
212 | endif |
---|
213 | from -t -n # Check for mail |
---|
214 | (olc who &) >& /dev/null # Ping the OLC server |
---|
215 | if (! $?skip_xss) then |
---|
216 | (xss -no-splash &) |
---|
217 | endif |
---|
218 | # Note: authwatch uses the present value of $KRB5CCNAME, which may |
---|
219 | # be modified by ~/.environment. However, if bash users make a |
---|
220 | # similar change in ~/.bash_environment, that change will NOT be |
---|
221 | # seen by this invocation of authwatch. |
---|
222 | if (! $?skip_authwatch) then |
---|
223 | (authwatch &) |
---|
224 | endif |
---|
225 | endif |
---|
226 | |
---|
227 | |
---|
228 | # Run the window-session customizing commands in your ~/.startup.X |
---|
229 | # file. We want to background this process in case something in the |
---|
230 | # startup hangs. Thus, the user will not be left with active windows |
---|
231 | # and no method of easily logging out. |
---|
232 | |
---|
233 | # We also run the notification system, lert. Ideally, we wish the user |
---|
234 | # to receive the alert in the form of a zephyrgram, and since they may |
---|
235 | # run zwgc from their .startup.X, we wait until that has finished. To |
---|
236 | # skip lert (a generally bad idea unless you plan to run it yourself - |
---|
237 | # it is not at all intended for frivolous messages), put the commend |
---|
238 | # "set skip_lert" in your ~/.environment file. |
---|
239 | |
---|
240 | if ((! $?NOCALLS) && (-r ~/.startup.X)) then |
---|
241 | if ($?verbose_login) then |
---|
242 | echo "Running custom startup activities listed in ~/.startup.X..." |
---|
243 | endif |
---|
244 | ( source ~/.startup.X; \ |
---|
245 | if (! $?skip_lert) lert -q -z ; \ |
---|
246 | if ($?verbose_login) echo "Session initialization completed." & ) |
---|
247 | else |
---|
248 | if (! $?skip_lert) lert -q -z |
---|
249 | echo "Session initialization completed." |
---|
250 | endif |
---|
251 | |
---|
252 | if ($?offer_gnome_failure) then |
---|
253 | set dtext = ( \ |
---|
254 | "\n" \ |
---|
255 | " If the conversion went well, your desktop should look about the \n" \ |
---|
256 | " same as it used to. If not, you might be missing panel buttons \n" \ |
---|
257 | " or other elements of the desktop. \n" \ |
---|
258 | "\n" \ |
---|
259 | " Do you wish to keep the results of the conversion?\n" ) |
---|
260 | if ( ! { gdialog --title "GNOME failure check" --yesno "$dtext" 7 70 } ) then |
---|
261 | set dtext = ( \ |
---|
262 | "\n" \ |
---|
263 | " You will now be logged out. On your next login, you will \n" \ |
---|
264 | " receive the GNOME 2 defaults. \n" ) |
---|
265 | gdialog --infobox "$dtext" 4 70 |
---|
266 | touch ~/.athena_gnome_convert_failure |
---|
267 | exit |
---|
268 | endif |
---|
269 | unset dtext |
---|
270 | endif |
---|
271 | |
---|
272 | |
---|
273 | # Gate the session. |
---|
274 | |
---|
275 | # This command replaces this script and will wait for you to log out. |
---|
276 | # To terminate this process, logout (type the "logout" command in any |
---|
277 | # xterm window, use the Logout button, or select the "Logout of |
---|
278 | # Athena" option from Dash), or invoke the "end_session" program. |
---|
279 | |
---|
280 | if ($?NOCALLS) then |
---|
281 | exec session_gate |
---|
282 | else |
---|
283 | exec session_gate -logout |
---|
284 | endif |
---|
285 | |
---|
286 | # The session gate will source .logout when it gets a SIGHUP, if |
---|
287 | # invoked with the -logout flag. |
---|