A typical user ".xsession" file would then contain various commands to set up the X environment (similar to the above default setups). However, a user who has accounts on different systems may not want to run X the same on all machines especially different machines from different manufacturers! Therefore my ".xsession" file looks like this:
#!/bin/csh
if { 4d } exec .indigo/.xsession
if { sun } exec .sun/.xsession
if { dec } exec .dec/.xsession
if { ibm } exec .ibm/.xsession
exec .xinitrc
The ".xsession" file in my area is as shown below:
#!/bin/csh -f
# set XENVIRONMENT: this resource file is read by each application at startup.
setenv XENVIRONMENT $HOME/.Xdefaults
# Xlib looks at the value of XUSERFILESEARCHPATH to find a dir of resource files
setenv XUSERFILESEARCHPATH "$HOME/%N:`/usr/bin/X11/appdefpath`"
xdpyinfo | awk ' /dimensions/ {print "setenv XSCREEN " $2 > ".xscreen" }'
# source the file so that the variable is known to this shell and pause for the source to take place
source .xscreen
wait &
# If the source failed, i.e. don't have permissions to write to directory,
# etc., assume that you are on the 1280x1024 size monitor and load the X resource data base with that default file.
# NOTE: you could have one default file and test for the resolutions there, instead of have 2 different files
# as this .xsession file does. You still, have to get the XSCREEN variable as you do here.
if (!($?XSCREEN)) then
xrdb -merge .Xdefaults_1280 &
endif
# If there is the XSCREEN variable, then make the seperate tests for the dimensions and call the correct Xdefault file.
if ($XSCREEN == '1024x768') then
if (-f ~/.Xdefaults_1024) then
xrdb -merge ~/.Xdefaults_1024 &
setenv XUSERFILESEARCHPATH "$HOME/%N:`/usr/bin/X11/appdefpath`:$HOME/.app-defaults_1024/%N"
# set XENVIRONMENT: this resource file is read by each application at startup.
setenv XENVIRONMENT $HOME/.indigo/.Xdefaults_1024
endif
endif
if ($XSCREEN == '1280x1024') then
if (-f ~/.Xdefaults_1280) then
xrdb -merge ~/.Xdefaults_1280 &
setenv XUSERFILESEARCHPATH "$HOME/%N:`/usr/bin/X11/appdefpath`:$HOME/.app-defaults_1280/%N"
# set XENVIRONMENT: this resource file is read by each application at startup.
setenv XENVIRONMENT $HOME/.indigo/.Xdefaults_1280
endif
endif
#If you display clients from remote machines back to your own console you can uncomment the next line.
#/usr/bin/X11/xhost +
# start the window manager
/usr/bin/X11/4Dwm&
/usr/bin/X11/wait4wm
# Test for screen dimensions then size the console window:
# Now go ahead and start up the xwsh's depending on the screen resolution of the machine we're currently on.
# See XWSH(1G) for X-world command line options. "xwsh -help" is a handy reminder of what options exist.
#
if ($XSCREEN == '1024x768') then
xclock -geom 90x90+0+0 -analog -fn 12x24 -bd grey23 &
xwsh -title `hostname` -geometry 80x40+287+20 -fn "*-lucidatypewriter-bold-*-*-*-*-8-100-100-*" -fg \
54 -bg 98 -selbg 165 -selfg 9 -cursorfg 3 &
setenv CONSOLE true
xwsh -title console -icontitle console -geometry 80x40+0-2 -fn "*-lucidatypewriter-bold-*-*-*-*-8-100-100-*" \
-fg 54 -bg 98 -selbg 165 -selfg 9 -cursorfg 3 &
endif
if ($XSCREEN == '1280x1024') then
xclock -geom 90x90+0+0 -analog -fn 12x24 -bd grey23 &
xwsh -title `hostname` -geometry 80x40+543+20 -fn "*-lucidatypewriter-bold-*-*-*-*-8-100-100-*" -fg \
54 -bg 0 -selbg 165 -selfg 9 -cursorfg 3 &
setenv CONSOLE true
xwsh -title console -icontitle console -geometry 80x40+0-2 -fn "*-lucidatypewriter-bold-*-*-*-*-8-100-100-*" \
-fg 54 -bg 0 -selbg 165 -selfg 9 -cursorfg 3 &
endif
# set some user preferences using the XSET(1) utility
xset fp+ /usr/lib/fmfonts -art 40 -ari 3 &
# make a granite-textured root-window background
#/usr/bin/X11/xsetroot -bitmap /usr/include/X11/bitmaps/granite -fg \#043 -bg black
# the magic last client. when this client exits, the session is terminated
/usr/bin/X11/reaper
So this file is very important!!!In my real ".xsession" I also run a screen locker:
~raytrace/bin.4d/xautolock -time 5 -locker '/usr/bin/X11/tellwm minimize
a time management tool:
calentool -fullscreendebug -o -x 2>>& ~/.xsession-errors&
and an X based mailtool:
xmailtool -iconic -color&