分类: LINUX
2008-08-20 18:26:13
#!/bin/sh # #/etc/X11/Xsession # #globalXsessionfile--usedbydisplaymanagersandxinit(startx) #$Id:Xsession21862005-02-1107:11:05Zbranden$ set-e PROGNAME=Xsession message(){ #pretty-printmessagesofarbitrarylength;usexmessageifit #isavailableand$DISPLAYisset MESSAGE="$PROGNAME:$*" echo"$MESSAGE"|fold-s-w${COLUMNS:-80}>&2 if[-n"$DISPLAY"]&&whichxmessage>/dev/null2>&1;then echo"$MESSAGE"|fold-s-w${COLUMNS:-80}|xmessage-center-file- fi } message_nonl(){ #pretty-printmessagesofarbitrarylength(notrailingnewline);use #xmessageifitisavailableand$DISPLAYisset MESSAGE="$PROGNAME:$*" echo-n"$MESSAGE"|fold-s-w${COLUMNS:-80}>&2; if[-n"$DISPLAY"]&&whichxmessage>/dev/null2>&1;then echo-n"$MESSAGE"|fold-s-w${COLUMNS:-80}|xmessage-center-file- fi } errormsg(){ #exitscriptwitherror message"$*" exit1 } internal_errormsg(){ #exitscriptwitherror;essentiallya"THISSHOULDNEVERHAPPEN"message #Onebigcalltomessage()forthesakeofxmessage;ifwehadtwothen #theuserwouldhavedismissedtheerrorwewantreportedbeforeseeingthe #requesttoreportit. errormsg"$*"\ "Pleasereporttheinstalledversionofthe\"xfree86-common\""\ "packageandthecompletetextofthiserrormessageto"\ " ." } #initializevariablesforusebyallsessionscripts OPTIONFILE=/etc/X11/Xsession.options SYSRESOURCES=/etc/X11/Xresources USRRESOURCES=$HOME/.Xresources SYSSESSIONDIR=/etc/X11/Xsession.d USERXSESSION=$HOME/.xsession ALTUSERXSESSION=$HOME/.Xsession ERRFILE=$HOME/.xsession-errors #attempttocreateanerrorfile;abortifwecannot iftouch"$ERRFILE"2>/dev/null&&[-w"$ERRFILE"]&& [!-L"$ERRFILE"];then chmod600"$ERRFILE" elifERRFILE=$(tempfile2>/dev/null);then if!ln-sf"$ERRFILE""${TMPDIR:=/tmp}/xsession-$USER";then message"warning:unabletosymlink\"$TMPDIR/xsession-$USER\"to"\ "\"$ERRFILE\";lookforsessionlog/errorsin"\ "\"$TMPDIR/xsession-$USER\"." fi else errormsg"unabletocreateXsessionlog/errorfile;aborting." fi exec>>"$ERRFILE"2>&1 echo"$PROGNAME:Xsessionstartedfor$LOGNAMEat$(date)" #sanitycheck;isoursessionscriptdirectorypresent? if[!-d"$SYSSESSIONDIR"];then errormsg"no\"$SYSSESSIONDIR\"directoryfound;aborting." fi #Attempttocreateafileofnon-zerolengthin/tmp;afullfilesystemcan #causemysteriousXsessionfailures.Wedonotusetouch,:,ortest-w #becausetheywon''tactuallycreateafilewithcontents.Wealsoletstandard #errorfromtempfileandechogototheerrorfiletoaidtheuserin #determiningwhatwentwrong. WRITE_TEST=$(tempfile) if!echo"*">>"$WRITE_TEST";then message"warning:unabletowriteto${WRITE_TEST%/*};Xsessionmayexit"\ "withanerror" fi rm-f"$WRITE_TEST" #Userun-partstosourceeveryfileinthesessiondirectory;wesource #insteadofexecutingsothatthevariablesandfunctionsdefinedabove #areavailabletothescripts,andsothattheycanpassvariablestoeach #other. SESSIONFILES=$(run-parts--list$SYSSESSIONDIR) if[-n"$SESSIONFILES"];then forSESSIONFILEin$SESSIONFILES;do .$SESSIONFILE done fi exit0
SESSIONFILES=$(run-parts--list$SYSSESSIONDIR) if[-n"$SESSIONFILES"];then forSESSIONFILEin$SESSIONFILES;do .$SESSIONFILE done fi
USERXSESSION=$HOME/.xsession ALTUSERXSESSION=$HOME/.Xsession
#$Id:50xfree86-common_determine-startup14372004-05-2303:18:32Zbranden$ #ThisfileissourcedbyXsession(5),notexecuted. #IfnoXsessionstartupprogramwaspassedtotheXsessionscriptasan #argument(e.g.,bythedisplaymanager),orifthatprogramwasnot #executable,fallbacktolookingforauser''scustomXsessionscript,if #allowedbytheoptionsfile. if[-z"$STARTUP"];then ifgrep-qs^allow-user-xsession"$OPTIONFILE";then forSTARTUPFILEin"$USERXSESSION""$ALTUSERXSESSION";do if[-e"$STARTUPFILE"];then if[-x"$STARTUPFILE"];then STARTUP="$STARTUPFILE" else STARTUP="sh$STARTUPFILE" fi break fi done fi fi #Ifthereisstillnothingtouseforastartupprogram,trythesystem #defaultsessionmanager,windowmanager,andterminalemulator. if[-z"$STARTUP"];then if[-x/usr/bin/x-session-manager];then STARTUP=x-session-manager elif[-x/usr/bin/x-window-manager];then STARTUP=x-window-manager elif[-x/usr/bin/x-terminal-emulator];then STARTUP=x-terminal-emulator fi fi #Ifwestillhavenotfoundastartupprogram,giveup. if[-z"$STARTUP"];then ERRMSG="unabletostartXsession---" ifgrep-qs^allow-user-xsession"$OPTIONFILE";then ERRMSG="$ERRMSGno\"$USERXSESSION\"file,no\"$ALTUSERXSESSION\"file," fi errormsg"$ERRMSGnosessionmanagers,nowindowmanagers,andnoterminal"\ "emulatorsfound;aborting." fi #vim:setaietsts=2sw=2tw=80:
forSTARTUPFILEin"$USERXSESSION""$ALTUSERXSESSION";do if[-e"$STARTUPFILE"];then if[-x"$STARTUPFILE"];then STARTUP="$STARTUPFILE" else STARTUP="sh$STARTUPFILE" fi break fi done
##!/bin/sh ##$Xorg:xinitrc.cpp,v1.32000/08/1719:54:30cpqbldExp$ # ##/etc/X11/xinit/xinitrc ## ##globalxinitrcfile,usedbyallXsessionsstartedbyxinit(startx) # ##invokeglobalXsessionscript ./etc/X11/Xsession
#!/bin/sh # #$Xorg:Xsession,v1.42000/08/1719:54:17cpqbldExp$ # # # # #$XFree86:xc/programs/xdm/config/Xsession,v1.32001/01/1723:45:24dawesExp$ #invokeglobalXsessionscript ./etc/X11/Xsession
XXsession.dcursorsgdmrstartxinit XF86Config-4Xsession.optionsdefault-display-managerlbxproxysysconfigxkb XresourcesXwrapper.configfontsproxymngrtwmxserver Xsessionapp-defaultsfsrgb.txtxdmxsm
exportLC_CTYPE=zh_CN.GBK exportXMODIFIERS="@im=fcitx" exportXIM=fcitx exportXIM_PROGRAM=fcitx fcitx