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