source: projects/specs/trunk/x/xorg-x11-xinit/Xclients @ 10989

Revision 10989, 3.1 KB checked in by iwaim, 7 years ago (diff)

xorg-x11-xinit: add flies

  • Property svn:executable set to *
Line 
1#!/bin/bash
2#                 by Jun Nishii <jun@vinelinux.org>
3#                 by Ryoichi INAGAKI <ryo1@bc.wakwak.com>
4#            Time-stamp: <2010-02-27 21:41:08 inagaki>
5
6msgfile="$HOME/.xwm.msgs"
7startWM(){
8    WM=$1
9    shift
10    CMD="$(type -p $1)"
11    shift
12    if [ -n "$CMD" ]; then
13        echo Starting $WM >>$msgfile
14        env > "$HOME"/Xrootenv.0
15        exec ${XSESSION_WRAPPER} $CMD $@ >>$msgfile 2>&1
16        return 0
17    fi
18    return -1
19}
20
21# First thing - check the user preferences
22if [ -f $HOME/.wm_style ] ; then
23    WMSTYLE=`cat $HOME/.wm_style`
24    case "$WMSTYLE" in
25        gnome*|Gnome*|GNOME*)
26            startWM Gnome gnome-session
27            ;;
28        startkde*|kde*|KDE*)
29            startWM KDE startkde
30            ;;
31        startxfce4*|xfce*|XFce*|XFCE*)
32            startWM XFce startxfce4
33            ;;
34        startlxde*|lxde*|LXDE*)
35            startWM lxde startlxde
36            ;;
37        wmaker*|WindowMaker*)
38            startWM WindowMaker RunWM --WindowMaker
39            ;;
40        afterstep*|Afterstep*|AfterStep*)
41            startWM AfterStep RunWM --AfterStep
42            ;;
43        blackbox*|BlackBox*|BLACKBOX*)
44            startWM BlackBox blackbox
45            ;;
46        fluxbox*|FluxBox*|FLUXBOX*)
47            startWM FluxBox startfluxbox
48            ;;
49        icewm*|IceWm*|ICEWM*)
50            startWM icewm icewm
51            ;;
52        enlightenment*|Enlightenment*|ENLIGHT*)
53            startWM Enlightenment enlightenment
54            ;;
55        sawfish*)
56            startWM sawfish sawfish
57            ;;
58        sawmill*)
59            startWM sawmill sawmill
60            ;;
61        qvwm*|QVWM*)
62            startWM qvwm qvwm
63            ;;
64        fvwm2*|FVWM2*)
65            startWM fvwm2 fvwm2
66            ;;
67        twm*|TWM*)
68            startWM twm twm &&\
69                 exec kterm -C -title Login -n Login -sb -geometry 80x25-0-0 -ls
70            ;;
71        default*)
72            startWM Gnome gnome-session
73            ;;
74    esac
75fi
76
77GSESSION="$(type -p gnome-session)"
78STARTKDE="$(type -p startkde)"
79
80# check to see if the user has a preferred desktop
81PREFERRED=
82if [ -f /etc/sysconfig/desktop ]; then
83    . /etc/sysconfig/desktop
84    if [ "$DESKTOP" = "GNOME" ]; then
85        PREFERRED="$GSESSION"
86    elif [ "$DESKTOP" = "KDE" ]; then
87        PREFERRED="$STARTKDE"
88    elif [ -n "`grep -i AnotherLevel /etc/sysconfig/desktop`" ]; then
89        PREFERRED=AnotherLevel
90    elif [ -x /usr/bin/gnome-session ]; then
91        PREFERRED=gnome-session
92    fi
93fi
94
95if [ -n "$PREFERRED" -a "$PREFERRED" != "AnotherLevel" ] && \
96        which $PREFERRED >/dev/null 2>&1; then
97    PREFERRED=`which $PREFERRED`
98    exec ${XSESSION_WRAPPER} $PREFERRED
99fi
100
101# We should also support /etc/X11/xinit/Xclients.d scripts
102XCLIENTS_D=/etc/X11/xinit/Xclients.d
103if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
104    exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
105fi
106
107# Failsafe.
108
109# these files are left sitting around by TheNextLevel.
110rm -f $HOME/Xrootenv.0
111
112# Argh! Nothing good is isntalled. Fall back to fvwm2 (win95-style) or twm
113{
114    # fall back to failsafe settings
115    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
116
117    if [ -x /usr/bin/xclock ] ; then
118        /usr/bin/xclock -geometry 100x100-5+5 &
119    fi
120    if [ -x /usr/bin/kterm ] ; then
121        /usr/bin/kterm -geometry 80x50-50+150 &
122    fi
123    if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
124        /usr/bin/firefox /usr/share/doc/HTML/index.html &
125    fi
126    startWM fvwm2 fvwm2 || startWM twm twm
127}
Note: See TracBrowser for help on using the repository browser.