slitaz-tools rev 335

Add support for favorite applications (browser, editor, terminal)
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 28 01:08:15 2009 +0200 (2009-04-28)
parents 8db152539be7
children 6e6809564b46
files rootfs/etc/slitaz/applications.conf tinyutils/browser tinyutils/desktopbox tinyutils/editor tinyutils/terminal
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rootfs/etc/slitaz/applications.conf	Tue Apr 28 01:08:15 2009 +0200
     1.3 @@ -0,0 +1,12 @@
     1.4 +# SliTaz default applications configuration file. Thes apps can be
     1.5 +# started throught wrappers: browser, editor and terminal.
     1.6 +#
     1.7 +
     1.8 +# Web browser.
     1.9 +BROWSER="firefox"
    1.10 +
    1.11 +# Text editor.
    1.12 +EDITOR="leafpad"
    1.13 +
    1.14 +# X terminal.
    1.15 +TERMINAL="xterm"
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tinyutils/browser	Tue Apr 28 01:08:15 2009 +0200
     2.3 @@ -0,0 +1,11 @@
     2.4 +#!/bin/sh
     2.5 +# Lauch SliTaz default Web browser.
     2.6 +#
     2.7 +. /etc/slitaz/applications.conf
     2.8 +
     2.9 +USER_CONFIG="$HOME/.config/slitaz/applications.conf"
    2.10 +[ -f  $USER_CONFIG ] && . $USER_CONFIG
    2.11 +
    2.12 +$BROWSER $@ &
    2.13 +
    2.14 +exit 0
     3.1 --- a/tinyutils/desktopbox	Sun Apr 26 13:50:45 2009 +0000
     3.2 +++ b/tinyutils/desktopbox	Tue Apr 28 01:08:15 2009 +0200
     3.3 @@ -5,7 +5,7 @@
     3.4  #
     3.5  # (C) GNU gpl v3 - SliTaz GNU/Linux 2008.
     3.6  #
     3.7 -VERSION=20080719
     3.8 +VERSION=20090428
     3.9  
    3.10  # Glade XML file path.
    3.11  GLADE_XML=/usr/share/slitaz-tools/glade
    3.12 @@ -410,6 +410,81 @@
    3.13  </vbox>
    3.14  </window>'
    3.15  		;;
    3.16 +	tazapps)
    3.17 +		# Default applications configuration script. System wide config file
    3.18 +		# is /etc/slitaz/applications.conf and each user can have personnal
    3.19 +		# settings. System wide for root and personnal config for user.
    3.20 +		if test $(id -u) = 0; then
    3.21 +			export CONFIG="/etc/slitaz/applications.conf"
    3.22 +		else
    3.23 +			export CONFIG="$HOME/.config/slitaz/applications.conf"
    3.24 +			if [ ! -f $CONFIG ]; then
    3.25 +				mkdir -p $HOME/.config/slitaz
    3.26 +				cp /etc/slitaz/applications.conf $CONFIG
    3.27 +			fi
    3.28 +		fi
    3.29 +
    3.30 +		export DESKTOP_DIALOG='
    3.31 +<window title="SliTaz default applications" icon-name="preferences-desktop">
    3.32 +<vbox>
    3.33 +	<vbox>
    3.34 +		<text wrap="false" width-chars="50">
    3.35 +			<label>"
    3.36 +SliTaz default applications configuration
    3.37 +			"</label>
    3.38 +		</text>
    3.39 +	</vbox>
    3.40 +	<hbox>
    3.41 +		<text wrap="false">
    3.42 +			<label>"Web browser:"</label>
    3.43 +		</text>
    3.44 +		<entry>
    3.45 +			<input>. $CONFIG; echo $BROWSER</input>
    3.46 +			<variable>BROWSER</variable>
    3.47 +		</entry>
    3.48 +		<button>
    3.49 +			<label>Change</label>
    3.50 +			<input file icon="forward"></input>
    3.51 +			<action>sed -i s/"BROWSER=.*"/"BROWSER=\"$BROWSER\""/ $CONFIG</action>
    3.52 +		</button>
    3.53 +	</hbox>
    3.54 +	<hbox>
    3.55 +		<text wrap="false">
    3.56 +			<label>"Text editor:    "</label>
    3.57 +		</text>
    3.58 +		<entry>
    3.59 +			<input>. $CONFIG; echo $EDITOR</input>
    3.60 +			<variable>EDITOR</variable>
    3.61 +		</entry>
    3.62 +		<button>
    3.63 +			<label>Change</label>
    3.64 +			<input file icon="forward"></input>
    3.65 +			<action>sed -i s/"EDITOR=.*"/"EDITOR=\"$EDITOR\""/ $CONFIG</action>
    3.66 +		</button>
    3.67 +	</hbox>
    3.68 +	<hbox>
    3.69 +		<text wrap="false">
    3.70 +			<label>"X terminal:     "</label>
    3.71 +		</text>
    3.72 +		<entry>
    3.73 +			<input>. $CONFIG; echo $TERMINAL</input>
    3.74 +			<variable>TERMINAL</variable>
    3.75 +		</entry>
    3.76 +		<button>
    3.77 +			<label>Change</label>
    3.78 +			<input file icon="forward"></input>
    3.79 +			<action>sed -i s/"TERMINAL=.*"/"TERMINAL=\"$TERMINAL\""/ $CONFIG</action>
    3.80 +		</button>
    3.81 +	</hbox>
    3.82 +	<hbox>
    3.83 +		<button>
    3.84 +			<label>Exit</label>
    3.85 +			<input file icon="exit"></input>	
    3.86 +			<action type="exit">exit</action>
    3.87 +		</button>
    3.88 +	</hbox>
    3.89 +</vbox>
    3.90 +</window>' ;;
    3.91  	*_*)
    3.92  		# Exec all function called by args (must have an underscore).
    3.93  		$1
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tinyutils/editor	Tue Apr 28 01:08:15 2009 +0200
     4.3 @@ -0,0 +1,11 @@
     4.4 +#!/bin/sh
     4.5 +# Lauch SliTaz default Text Editor.
     4.6 +#
     4.7 +. /etc/slitaz/applications.conf
     4.8 +
     4.9 +USER_CONFIG="$HOME/.config/slitaz/applications.conf"
    4.10 +[ -f  $USER_CONFIG ] && . $USER_CONFIG
    4.11 +
    4.12 +$EDITOR $@ &
    4.13 +
    4.14 +exit 0
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tinyutils/terminal	Tue Apr 28 01:08:15 2009 +0200
     5.3 @@ -0,0 +1,11 @@
     5.4 +#!/bin/sh
     5.5 +# Lauch SliTaz default X Terminal.
     5.6 +#
     5.7 +. /etc/slitaz/applications.conf
     5.8 +
     5.9 +USER_CONFIG="$HOME/.config/slitaz/applications.conf"
    5.10 +[ -f  $USER_CONFIG ] && . $USER_CONFIG
    5.11 +
    5.12 +$TERMINAL $@ &
    5.13 +
    5.14 +exit 0