slitaz-tools view tinyutils/tazx @ rev 46

Improved tazx again...
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 05 15:07:00 2008 +0100 (2008-02-05)
parents 6b802fc9bc6c
children d461ad5d4b43
line source
1 #!/bin/sh
2 #
3 # Tazx - Ncurses startx script for SliTaz GNU/Linux using Dialog boxes.
4 # This tinyutils is part of slitaz-tools.
5 #
6 # 20080204 <pankso@slitaz.org> - GNU gpl v3.
7 #
8 : ${DIALOG=dialog}
10 # Variables.
11 XSERVER=Xvesa
12 DOC=/usr/share/doc/slitaz-tools/tazx.txt
13 MOUSE=/dev/input/mice,5
14 # WM can be specified on cmdline.
15 if [ -n "$1" ]; then
16 WM=$1
17 else
18 WM=jwm
19 fi
21 # Main dialog.
22 exec 3>&1
23 value=`$DIALOG --help-button \
24 --clear --colors \
25 --title " Configure X " \
26 --menu \
27 "L'application 'tazx' permet de configurer votre session X.\n\
28 Gestionnaire de fenêtres : \Z2$WM\Zn" 16 70 5 \
29 "640x480x16" "TrueColor" \
30 "640x480x24" "TrueColor" \
31 "800x600x16" "TrueColor" \
32 "800x600x24" "TrueColor" \
33 "1024x768x16" "TrueColor" \
34 "1024x768x24" "TrueColor" \
35 "1280x800x16" "TrueColor" \
36 "1280x800x24" "TrueColor" \
37 "1280x1024x16" "TrueColor" \
38 "1280x1024x24" "TrueColor" \
39 "1600x1200x16" "TrueColor" \
40 "1600x1200x24" "TrueColor" \
41 "1920x1440x16" "TrueColor" \
42 "xterm" "800x600x16" \
43 "quit" "Quitter" \
44 2>&1 1>&3`
45 retval=$?
46 exec 3>&-
48 # Continue, exit or help...
49 case $retval in
50 0)
51 continue ;;
52 1)
53 echo "Cancel pressed..."
54 exit 0 ;;
55 2)
56 $DIALOG --clear \
57 --title " Aide - Help " --textbox "$DOC" 15 70
58 exec tazx ;;
59 255)
60 if test -n "$value"; then
61 continue
62 else
63 echo "ESC pressed..."
64 exit 0
65 fi ;;
66 esac
68 # Set selected value.
69 case $value in
70 xterm)
71 Xvesa -ac -shadow -screen 800x600x24 -br &
72 exec xterm -cr orange -geometry 80x35+0-0 ;;
73 *)
74 SCREEN=$value ;;
75 esac
77 # Copy a JWM system config if any present in user home
78 if [ ! -f "$HOME/.jwmrc" ]; then
79 cp /etc/jwm/system.jwmrc $HOME/.jwmrc
80 fi
81 # Change backgroud image if the 3/4 is not respected.
82 if echo $SCREEN | grep -q '1280x1024'; then
83 sed -i s/'1024x768.png'/'1280x1024.png'/ $HOME/.jwmrc
84 fi
85 if echo $SCREEN | grep -q '1024x768'; then
86 sed -i s/'1280x1024.png'/'1024x768.png'/ $HOME/.jwmrc
87 fi
88 # Tile Wallpaper for 1280x800.
89 if echo $SCREEN | grep -q '1280x800'; then
90 sed -i s/'type="image"'/'type="tile"'/ $HOME/.jwmrc
91 fi
93 # e17 start with enlightenment_start.
94 if [ "$WM" == "e17" ]; then
95 WM=enlightenment_start
96 XSEVER_OPTS="dpms -terminate"
97 fi
99 # Creat ~/.xsession to keep the configuration selected.
100 #
101 cat > $HOME/.xsession << _EOT_
102 # ~/.xsession: Start X window session on your system.
103 #
104 $XSERVER -ac -shadow $XSEVER_OPTS -screen $SCREEN -mouse $MOUSE &
105 #mpg123 sound.wav &
106 #xterm -bg black -fg white -cr orange &
107 #xpad &
108 exec $WM
109 _EOT_
111 chmod 700 $HOME/.xsession
113 # Console messages.
114 echo "X server : $XSERVER"
115 echo "Screen : $SCREEN"
116 echo "Exec WM : $WM"
117 echo ""
119 exit 0