| [10989] | 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 | |
|---|
| 6 | msgfile="$HOME/.xwm.msgs" |
|---|
| 7 | startWM(){ |
|---|
| 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 |
|---|
| 22 | if [ -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 | ;; |
|---|
| [10990] | 37 | startmate*|mate*|MATE*) |
|---|
| 38 | startWM Mate mate-session |
|---|
| 39 | ;; |
|---|
| [10989] | 40 | wmaker*|WindowMaker*) |
|---|
| 41 | startWM WindowMaker RunWM --WindowMaker |
|---|
| 42 | ;; |
|---|
| 43 | afterstep*|Afterstep*|AfterStep*) |
|---|
| 44 | startWM AfterStep RunWM --AfterStep |
|---|
| 45 | ;; |
|---|
| 46 | blackbox*|BlackBox*|BLACKBOX*) |
|---|
| 47 | startWM BlackBox blackbox |
|---|
| 48 | ;; |
|---|
| 49 | fluxbox*|FluxBox*|FLUXBOX*) |
|---|
| 50 | startWM FluxBox startfluxbox |
|---|
| 51 | ;; |
|---|
| 52 | icewm*|IceWm*|ICEWM*) |
|---|
| 53 | startWM icewm icewm |
|---|
| 54 | ;; |
|---|
| 55 | enlightenment*|Enlightenment*|ENLIGHT*) |
|---|
| 56 | startWM Enlightenment enlightenment |
|---|
| 57 | ;; |
|---|
| 58 | sawfish*) |
|---|
| 59 | startWM sawfish sawfish |
|---|
| 60 | ;; |
|---|
| 61 | sawmill*) |
|---|
| 62 | startWM sawmill sawmill |
|---|
| 63 | ;; |
|---|
| 64 | qvwm*|QVWM*) |
|---|
| 65 | startWM qvwm qvwm |
|---|
| 66 | ;; |
|---|
| 67 | fvwm2*|FVWM2*) |
|---|
| 68 | startWM fvwm2 fvwm2 |
|---|
| 69 | ;; |
|---|
| 70 | twm*|TWM*) |
|---|
| 71 | startWM twm twm &&\ |
|---|
| 72 | exec kterm -C -title Login -n Login -sb -geometry 80x25-0-0 -ls |
|---|
| 73 | ;; |
|---|
| 74 | default*) |
|---|
| 75 | startWM Gnome gnome-session |
|---|
| 76 | ;; |
|---|
| 77 | esac |
|---|
| 78 | fi |
|---|
| 79 | |
|---|
| 80 | GSESSION="$(type -p gnome-session)" |
|---|
| 81 | STARTKDE="$(type -p startkde)" |
|---|
| 82 | |
|---|
| 83 | # check to see if the user has a preferred desktop |
|---|
| 84 | PREFERRED= |
|---|
| 85 | if [ -f /etc/sysconfig/desktop ]; then |
|---|
| 86 | . /etc/sysconfig/desktop |
|---|
| 87 | if [ "$DESKTOP" = "GNOME" ]; then |
|---|
| 88 | PREFERRED="$GSESSION" |
|---|
| 89 | elif [ "$DESKTOP" = "KDE" ]; then |
|---|
| 90 | PREFERRED="$STARTKDE" |
|---|
| 91 | elif [ -n "`grep -i AnotherLevel /etc/sysconfig/desktop`" ]; then |
|---|
| 92 | PREFERRED=AnotherLevel |
|---|
| 93 | elif [ -x /usr/bin/gnome-session ]; then |
|---|
| 94 | PREFERRED=gnome-session |
|---|
| 95 | fi |
|---|
| 96 | fi |
|---|
| 97 | |
|---|
| 98 | if [ -n "$PREFERRED" -a "$PREFERRED" != "AnotherLevel" ] && \ |
|---|
| 99 | which $PREFERRED >/dev/null 2>&1; then |
|---|
| 100 | PREFERRED=`which $PREFERRED` |
|---|
| 101 | exec ${XSESSION_WRAPPER} $PREFERRED |
|---|
| 102 | fi |
|---|
| 103 | |
|---|
| 104 | # We should also support /etc/X11/xinit/Xclients.d scripts |
|---|
| 105 | XCLIENTS_D=/etc/X11/xinit/Xclients.d |
|---|
| 106 | if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then |
|---|
| 107 | exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh" |
|---|
| 108 | fi |
|---|
| 109 | |
|---|
| 110 | # Failsafe. |
|---|
| 111 | |
|---|
| 112 | # these files are left sitting around by TheNextLevel. |
|---|
| 113 | rm -f $HOME/Xrootenv.0 |
|---|
| 114 | |
|---|
| 115 | # Argh! Nothing good is isntalled. Fall back to fvwm2 (win95-style) or twm |
|---|
| 116 | { |
|---|
| 117 | # fall back to failsafe settings |
|---|
| 118 | [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45' |
|---|
| 119 | |
|---|
| 120 | if [ -x /usr/bin/xclock ] ; then |
|---|
| 121 | /usr/bin/xclock -geometry 100x100-5+5 & |
|---|
| 122 | fi |
|---|
| 123 | if [ -x /usr/bin/kterm ] ; then |
|---|
| 124 | /usr/bin/kterm -geometry 80x50-50+150 & |
|---|
| 125 | fi |
|---|
| 126 | if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then |
|---|
| 127 | /usr/bin/firefox /usr/share/doc/HTML/index.html & |
|---|
| 128 | fi |
|---|
| 129 | startWM fvwm2 fvwm2 || startWM twm twm |
|---|
| 130 | } |
|---|