slitaz-tools rev 339

Improve and add all WM to tazx + WM config in applications.conf
author Christophe Lincoln <pankso@slitaz.org>
date Mon May 04 22:37:14 2009 +0200 (2009-05-04)
parents 4e661d6dced9
children ba541e2168a6
files rootfs/etc/slitaz/applications.conf tinyutils/desktopbox tinyutils/tazx
line diff
     1.1 --- a/rootfs/etc/slitaz/applications.conf	Thu Apr 30 23:21:22 2009 +0200
     1.2 +++ b/rootfs/etc/slitaz/applications.conf	Mon May 04 22:37:14 2009 +0200
     1.3 @@ -10,3 +10,6 @@
     1.4  
     1.5  # X terminal.
     1.6  TERMINAL="xterm"
     1.7 +
     1.8 +# Window manager.
     1.9 +WINDOW_MANAGER="openbox"
     2.1 --- a/tinyutils/desktopbox	Thu Apr 30 23:21:22 2009 +0200
     2.2 +++ b/tinyutils/desktopbox	Mon May 04 22:37:14 2009 +0200
     2.3 @@ -414,21 +414,16 @@
     2.4  		# Default applications configuration script. System wide config file
     2.5  		# is /etc/slitaz/applications.conf and each user can have personnal
     2.6  		# settings. System wide for root and personnal config for user.
     2.7 -		if test $(id -u) = 0; then
     2.8 -			export CONFIG="/etc/slitaz/applications.conf"
     2.9 -		else
    2.10 -			export CONFIG="$HOME/.config/slitaz/applications.conf"
    2.11 -			if [ ! -f $CONFIG ]; then
    2.12 -				mkdir -p $HOME/.config/slitaz
    2.13 -				cp /etc/slitaz/applications.conf $CONFIG
    2.14 -			fi
    2.15 +		export CONFIG="$HOME/.config/slitaz/applications.conf"
    2.16 +		if [ ! -f $CONFIG ]; then
    2.17 +			mkdir -p $HOME/.config/slitaz
    2.18 +			cp /etc/slitaz/applications.conf $CONFIG
    2.19  		fi
    2.20 -
    2.21  		export DESKTOP_DIALOG='
    2.22  <window title="SliTaz default applications" icon-name="preferences-desktop">
    2.23  <vbox>
    2.24  	<vbox>
    2.25 -		<text wrap="false" width-chars="50">
    2.26 +		<text wrap="false" width-chars="54">
    2.27  			<label>"
    2.28  SliTaz default applications configuration
    2.29  			"</label>
    2.30 @@ -436,7 +431,7 @@
    2.31  	</vbox>
    2.32  	<hbox>
    2.33  		<text wrap="false">
    2.34 -			<label>"Web browser:"</label>
    2.35 +			<label>"Web browser:      "</label>
    2.36  		</text>
    2.37  		<entry>
    2.38  			<input>. $CONFIG; echo $BROWSER</input>
    2.39 @@ -450,7 +445,7 @@
    2.40  	</hbox>
    2.41  	<hbox>
    2.42  		<text wrap="false">
    2.43 -			<label>"Text editor:    "</label>
    2.44 +			<label>"Text editor:          "</label>
    2.45  		</text>
    2.46  		<entry>
    2.47  			<input>. $CONFIG; echo $EDITOR</input>
    2.48 @@ -464,7 +459,7 @@
    2.49  	</hbox>
    2.50  	<hbox>
    2.51  		<text wrap="false">
    2.52 -			<label>"X terminal:     "</label>
    2.53 +			<label>"X terminal:           "</label>
    2.54  		</text>
    2.55  		<entry>
    2.56  			<input>. $CONFIG; echo $TERMINAL</input>
    2.57 @@ -477,6 +472,20 @@
    2.58  		</button>
    2.59  	</hbox>
    2.60  	<hbox>
    2.61 +		<text wrap="false">
    2.62 +			<label>"Window manager:"</label>
    2.63 +		</text>
    2.64 +		<entry>
    2.65 +			<input>. $CONFIG; echo $WINDOW_MANAGER</input>
    2.66 +			<variable>WINDOW_MANAGER</variable>
    2.67 +		</entry>
    2.68 +		<button>
    2.69 +			<label>Change</label>
    2.70 +			<input file icon="forward"></input>
    2.71 +			<action>sed -i s/"WINDOW_MANAGER=.*"/"WINDOW_MANAGER=\"$WINDOW_MANAGER\""/ $CONFIG</action>
    2.72 +		</button>
    2.73 +	</hbox>
    2.74 +	<hbox>
    2.75  		<button>
    2.76  			<label>Exit</label>
    2.77  			<input file icon="exit"></input>	
     3.1 --- a/tinyutils/tazx	Thu Apr 30 23:21:22 2009 +0200
     3.2 +++ b/tinyutils/tazx	Mon May 04 22:37:14 2009 +0200
     3.3 @@ -10,7 +10,6 @@
     3.4  : ${DIALOG=tazdialog}
     3.5  
     3.6  # Variables.
     3.7 -#
     3.8  XSERVER=Xvesa
     3.9  DOC=/usr/share/doc/slitaz-tools/tazx.txt
    3.10  MOUSE=/dev/input/mice,5
    3.11 @@ -20,7 +19,7 @@
    3.12  else
    3.13  	WM=openbox
    3.14  fi
    3.15 -# Default user for config files
    3.16 +# Default user for config files in Live mode.
    3.17  USER=`cat /etc/passwd | grep 1000 | cut -d ":" -f 1`
    3.18  
    3.19  ####################
    3.20 @@ -178,7 +177,7 @@
    3.21  	# Set selected value.
    3.22  	case $value in
    3.23  		xorg)
    3.24 -			install_xorg;;
    3.25 +			install_xorg ;;
    3.26  		xterm)
    3.27  			Xvesa -ac -shadow -screen 800x600x16 -br &
    3.28  			exec xterm -cr orange -geometry 80x35+0-0 ;;
    3.29 @@ -204,48 +203,80 @@
    3.30  	fi
    3.31  }
    3.32  
    3.33 -# e17 start with enlightenment_start.
    3.34 -e17_stuff()
    3.35 +# Window manager specific configuration.
    3.36 +wm_config()
    3.37  {
    3.38 -	if [ "$WM" == "e17" ]; then
    3.39 -		 WM=enlightenment_start
    3.40 -		 XSEVER_OPTS="dpms -terminate"
    3.41 -	fi
    3.42 -}
    3.43 -
    3.44 -# dwm start with dwm-session.
    3.45 -dwm_stuff()
    3.46 -{
    3.47 -	if [ "$WM" == "dwm" ]; then
    3.48 -		 WM=dwm-session
    3.49 -		 XSEVER_OPTS="dpms"
    3.50 -	fi
    3.51 -}
    3.52 -
    3.53 -# Openbox with openbox-session.
    3.54 -openbox_stuff()
    3.55 -{
    3.56 -	if [ "$WM" == "openbox" -o "$WM" == "ob" ]; then
    3.57 -		 WM=openbox-session
    3.58 -		 XSEVER_OPTS="dpms +extension Composite"
    3.59 -	fi
    3.60 -	# Check if a personal autostart script exists if OB is installed.
    3.61 -	if [ -d "/var/lib/tazpkg/installed/openbox" ]; then
    3.62 -		if [ ! -f "$HOME/.config/openbox/autostart.sh" ]; then
    3.63 -			mkdir -p $HOME/.config/openbox
    3.64 -			cp /etc/xdg/openbox/autostart.sh $HOME/.config/openbox
    3.65 -		fi
    3.66 -		# Script for default user (uid=1000).
    3.67 -		if [ ! -f "/home/$USER/.config/openbox/autostart.sh" ]; then
    3.68 -			mkdir -p /home/$USER/.config/openbox
    3.69 -			cp /etc/xdg/openbox/autostart.sh /home/$USER/.config/openbox
    3.70 -		fi
    3.71 -		if [ ! -f "/home/$USER/.config/openbox/menu.xml" ]; then
    3.72 -			mkdir -p /home/$USER/.config/openbox
    3.73 -			cp /etc/xdg/openbox/menu.xml /home/$USER/.config/openbox
    3.74 -		fi
    3.75 -		chown -R $USER.$USER /home/$USER/.config
    3.76 -	fi
    3.77 +	case $WM in
    3.78 +		ob|openbox)
    3.79 +			WM=openbox-session
    3.80 +			XSEVER_OPTS="dpms +extension Composite"
    3.81 +			# Check if a personal autostart script exists if OB is installed.
    3.82 +			if [ -d "/var/lib/tazpkg/installed/openbox" ]; then
    3.83 +				if [ ! -f "$HOME/.config/openbox/autostart.sh" ]; then
    3.84 +					mkdir -p $HOME/.config/openbox
    3.85 +					cp /etc/xdg/openbox/autostart.sh $HOME/.config/openbox
    3.86 +				fi
    3.87 +				# Script for default user (uid=1000).
    3.88 +				if [ ! -f "/home/$USER/.config/openbox/autostart.sh" ]; then
    3.89 +					mkdir -p /home/$USER/.config/openbox
    3.90 +					cp /etc/xdg/openbox/autostart.sh /home/$USER/.config/openbox
    3.91 +				fi
    3.92 +				if [ ! -f "/home/$USER/.config/openbox/menu.xml" ]; then
    3.93 +					mkdir -p /home/$USER/.config/openbox
    3.94 +					cp /etc/xdg/openbox/menu.xml /home/$USER/.config/openbox
    3.95 +				fi
    3.96 +				chown -R $USER.$USER /home/$USER/.config
    3.97 +			fi ;;
    3.98 +		jwm)
    3.99 +			WM=jwm
   3.100 +			XSEVER_OPTS="dpms +extension Composite"
   3.101 +			JWM_CONFIG=$HOME/.jwmrc
   3.102 +			if [ -d "/var/lib/tazpkg/installed/jwm" ]; then
   3.103 +				if [ ! -f "$JWM_CONFIG" ]; then
   3.104 +					cp /etc/jwm/system.jwmrc $JWM_CONFIG
   3.105 +				fi
   3.106 +				# In Live mode default user/root JWM config does not exist and
   3.107 +				# $HOME is not set, this is because tazx is executed by boot 
   3.108 +				# scripts.
   3.109 +				if [ ! -f "/home/$USER/.jwmrc" ]; then
   3.110 +					cp /etc/jwm/system.jwmrc /home/$USER/.jwmrc
   3.111 +					chown $USER.$USER /home/$USER/.jwmrc
   3.112 +				fi
   3.113 +				if [ ! -f "/root/.jwmrc" -a `id -u` = 0 ]; then
   3.114 +					cp /etc/jwm/system.jwmrc /root/.jwmrc
   3.115 +				fi
   3.116 +			fi ;;
   3.117 +		pekwm)
   3.118 +			WM=pekwm
   3.119 +			XSEVER_OPTS="dpms"
   3.120 +			if [ -d "/var/lib/tazpkg/installed/pekwm" ]; then
   3.121 +				if [ -d "$HOME/.pekwm" ]; then
   3.122 +					cp -R /etc/pekwm $HOME/.pekwm
   3.123 +				fi
   3.124 +				# In Live mode we want config before starting pekwm the first time.
   3.125 +				if [ ! -d "/home/$USER/.pekwm" ]; then
   3.126 +					cp -R /etc/pekwm /home/$USER/.pekwm
   3.127 +					chown -R $USER.$USER /home/$USER/.pekwm
   3.128 +					chmod +x /home/$USER/.pekwm/start
   3.129 +				fi
   3.130 +				if [ ! -d "/root/.pekwm" -a `id -u` = 0 ]; then
   3.131 +					cp -R /etc/pekwm /root/.pekwm
   3.132 +					chmod +x /root/.pekwm/start
   3.133 +				fi
   3.134 +			fi ;;
   3.135 +		e17|enlightenment)
   3.136 +			WM=enlightenment_start
   3.137 +			XSEVER_OPTS="dpms -terminate" ;;
   3.138 +		fluxbox)
   3.139 +			WM=startfluxbox
   3.140 +			XSEVER_OPTS="dpms" ;;
   3.141 +		dwm|karmen)
   3.142 +			WM=$WM-session
   3.143 +			XSEVER_OPTS="dpms" ;;
   3.144 +		awesome)
   3.145 +			WM=awesome
   3.146 +			XSEVER_OPTS="dpms" ;;
   3.147 +	esac
   3.148  }
   3.149  
   3.150  # Sample xinitrc for user (WM can be specified with F1 at slim login).
   3.151 @@ -253,65 +284,62 @@
   3.152  {
   3.153  	cat >  $FILE << "EOF"
   3.154  # ~/.xinitrc: Executed by slim login manager to startx X session.
   3.155 -# You can use F1 with Slim or 'tazx' to configure permanently
   3.156 -# your default WM: tazx e17
   3.157 +# You can use F1 with Slim to chage your window manager or configure
   3.158 +# it permanently with your personnal applications.conf file.
   3.159  #
   3.160 -WM=openbox-session
   3.161 +. $HOME/.config/slitaz/applications.conf
   3.162  
   3.163  case $1 in
   3.164 -	e17|enlightenment_start)
   3.165 +	e17|enlightenment*)
   3.166  		exec enlightenment_start ;;
   3.167  	openbox|openbox-session|ob)
   3.168  		exec openbox-session ;;
   3.169  	dwm|dwm-session)
   3.170  		exec dwm-session ;;
   3.171 +	fluxbox|startfluxbox)
   3.172 +		exec startfluxbox ;;
   3.173 +	awesome)
   3.174 +		exec awesome ;;
   3.175 +	pekwm)
   3.176 +		exec pekwm ;;
   3.177 +	karmen|karmen-session)
   3.178 +		exec karmen-session ;;
   3.179  	jwm)
   3.180  		lxpanel &
   3.181  		exec jwm ;;
   3.182  	*)
   3.183 -		exec $WM ;;
   3.184 +		exec $WINDOW_MANAGER ;;
   3.185  esac
   3.186  EOF
   3.187 -	# Set default WM.
   3.188 -	RES=`grep ^WM=[e-o] $FILE`
   3.189 -	sed -i s/"$RES"/"WM=$WM"/ $FILE
   3.190 +	# Set default WM in applications.conf user file. Default WM can be
   3.191 +	# configured graphicaly with 'desktopbox tazapps'
   3.192 +	. $CONFIG
   3.193 +	sed -i s/"WINDOW_MANAGER=.*"/"WINDOW_MANAGER=\"$WM\""/ \
   3.194 +		$CONFIG
   3.195  }
   3.196  
   3.197  # ~/.xinitrc for slim login.
   3.198  creat_xinitrc()
   3.199  {
   3.200  	FILE=$HOME/.xinitrc
   3.201 +	CONFIG=$HOME/.config/slitaz/applications.conf
   3.202 +	if [ ! -f $CONFIG ]; then
   3.203 +		mkdir -p $HOME/.config/slitaz
   3.204 +		cp /etc/slitaz/applications.conf $CONFIG
   3.205 +	fi
   3.206  	xinitrc_sample
   3.207 -
   3.208  	# In Live mode default user needs a xinitrc, since tazx
   3.209  	# is executed only by root.
   3.210  	if [ ! -f /home/$USER/.xinitrc ]; then
   3.211  		FILE=/home/$USER/.xinitrc
   3.212 +		CONFIG=/home/$USER/.config/slitaz/applications.conf
   3.213 +		if [ ! -f $CONFIG ]; then
   3.214 +			mkdir -p /home/$USER/.config/slitaz
   3.215 +			cp /etc/slitaz/applications.conf $CONFIG
   3.216 +		fi
   3.217  		xinitrc_sample
   3.218  		chown $USER.$USER $FILE
   3.219 -	fi
   3.220 -}
   3.221 -
   3.222 -# Copy a JWM system config if any present in user home.
   3.223 -jwm_config()
   3.224 -{
   3.225 -	if [ -d "/var/lib/tazpkg/installed/jwm" ]; then
   3.226 -		JWM_CONFIG=$HOME/.jwmrc
   3.227 -		if [ ! -f "$JWM_CONFIG" ]; then
   3.228 -			cp /etc/jwm/system.jwmrc $JWM_CONFIG
   3.229 -		fi
   3.230 -		# In Live mode default user/root JWM config does not exist and
   3.231 -		# $HOME is not set, this is because tazx is executed by boot 
   3.232 -		# scripts.
   3.233 -		if [ ! -f "/home/$USER/.jwmrc" ]; then
   3.234 -			JWM_CONFIG=/home/$USER/.jwmrc
   3.235 -			cp /etc/jwm/system.jwmrc $JWM_CONFIG
   3.236 -			chown $USER.$USER $JWM_CONFIG
   3.237 -		fi
   3.238 -		if [ ! -f "/root/.jwmrc" -a `id -u` = 0 ]; then
   3.239 -			JWM_CONFIG=/root/.jwmrc
   3.240 -			cp /etc/jwm/system.jwmrc $JWM_CONFIG
   3.241 -		fi
   3.242 +		chown -R $USER.$USER /home/$USER/.config/slitaz
   3.243  	fi
   3.244  }
   3.245  
   3.246 @@ -345,11 +373,8 @@
   3.247  
   3.248  [ -n "$NEW_SCREEN" ] || screen_config_dialog
   3.249  slim_config
   3.250 -e17_stuff
   3.251 -dwm_stuff
   3.252 -openbox_stuff
   3.253 +wm_config
   3.254  creat_xinitrc
   3.255 -jwm_config
   3.256  creat_xsession
   3.257  
   3.258  exit 0