3 # LightDM wrapper to run around X sessions.
5 echo "Running X session wrapper"
8 # pretty-print messages of arbitrary length; use xmessage if it
9 # is available and $DISPLAY is set
10 MESSAGE="$PROGNAME: $*"
11 echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
12 if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
13 echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
18 # exit script with error
24 for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
25 if [ -f "$file" ]; then
26 echo "Loading profile from $file";
32 if type xrdb >/dev/null 2>&1; then
33 xresourcedir="/etc/X11/Xresources"
34 if [ -d "$xresourcedir" ]; then
35 for file in $xresourcedir/*; do
36 echo "Loading resource: $file"
37 xrdb -nocpp -merge "$file"
40 xresourcefile="$HOME/.Xresources"
41 if [ -f "$xresourcefile" ]; then
42 echo "Loading resource: $xresourcefile"
43 xrdb -nocpp -merge "$xresourcefile"
48 if type setxkbmap >/dev/null 2>&1; then
49 for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
50 if [ -f "$file" ]; then
51 echo "Loading keymap: $file"
52 setxkbmap `cat "$file"`
58 # Load xmodmap if not using XKB
59 if type xmodmap >/dev/null 2>&1; then
60 if [ -z "$XKB_IN_USE" ]; then
61 for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
62 if [ -f "$file" ]; then
63 echo "Loading modmap: $file"
72 # Run all system xinitrc shell scripts.
73 xinitdir="/etc/X11/xinit/xinitrc.d"
74 if [ -d "$xinitdir" ]; then
75 for script in $xinitdir/*; do
76 echo "Loading xinit script $script"
77 if [ -x "$script" -a ! -d "$script" ]; then
83 # Load Xsession scripts
84 # OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
85 # by the scripts to work
86 xsessionddir="/etc/X11/Xsession.d"
87 OPTIONFILE=/etc/X11/Xsession.options
88 USERXSESSION=$HOME/.xsession
89 USERXSESSIONRC=$HOME/.xsessionrc
90 ALTUSERXSESSION=$HOME/.Xsession
92 if [ -d "$xsessionddir" ]; then
93 for i in `ls $xsessionddir`; do
94 script="$xsessionddir/$i"
95 echo "Loading X session script $script"
96 if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
102 echo "X session wrapper complete, running session $@"