rev |
line source |
pankso@553
|
1 #!/bin/sh
|
pankso@553
|
2 #
|
pankso@569
|
3 # SliTaz tiny GUI boxes for the desktop (su, logout, locale, etc)
|
pankso@569
|
4 # and as usual, please: KISS
|
pankso@553
|
5 #
|
pascal@821
|
6 # Copyright (C) 2011-2014 SliTaz GNU/Linux - GNU GPL v3
|
pankso@553
|
7 # - Christophe Lincoln <pankso@slitaz.org>
|
pankso@553
|
8 #
|
al@813
|
9 . /lib/libtaz.sh
|
al@813
|
10 export TEXTDOMAIN='tazbox' # i18n
|
pankso@553
|
11
|
al@813
|
12 # download dir (may be in a config file)
|
pankso@562
|
13 DOWNLOADS=$HOME/Downloads
|
pankso@562
|
14
|
al@813
|
15 # icons for most windows
|
al@813
|
16 #icon=/usr/share/pixmaps/slitaz-icon.png
|
pankso@562
|
17
|
claudinei@611
|
18 # some constants to be used inside functions
|
claudinei@611
|
19 tmp="/tmp/keymap.list"
|
claudinei@611
|
20 db="/usr/share/i18n/locales"
|
claudinei@611
|
21 zi="/usr/share/zoneinfo/"
|
claudinei@611
|
22
|
pankso@553
|
23 #
|
pankso@553
|
24 # Functions
|
pankso@553
|
25 #
|
pankso@553
|
26
|
pankso@553
|
27 usage() {
|
al@813
|
28 newline; _ 'SliTaz tiny GUI boxes for the desktop'
|
pankso@553
|
29
|
al@813
|
30 newline; boldify $(_ 'Usage:')
|
al@813
|
31 echo " $(basename $0) [$(_n 'command')]"
|
pankso@553
|
32
|
al@813
|
33 newline; boldify $(_ 'Commands:')
|
al@813
|
34 optlist "\
|
al@813
|
35 usage $(_ 'Display this short help usage')
|
al@813
|
36 su $(_ 'Execute a command as super-user')
|
al@813
|
37 logout $(_ 'Desktop logout box with actions')
|
al@813
|
38 out $(_ 'Pipe a command output into a GTK window')
|
al@813
|
39 out-dl $(_ 'Pipe wget output into a GTK window')
|
al@813
|
40 locale $(_ 'Configure system language (root)')
|
al@813
|
41 keymap $(_ 'Configure system keymap (root)')
|
al@813
|
42 tz $(_ 'Configure system timezone (root)')
|
al@813
|
43 setup $(_ 'System initial setup (locale, keymap & timezone)')
|
al@813
|
44 new-file $(_ 'Create a new file or folder on the desktop')
|
al@813
|
45 all-apps $(_ 'Display icons of all installed applications')
|
al@813
|
46 notify $(_ 'Notify user with a desktop centered box')
|
al@813
|
47 tazapps $(_ 'Configure SliTaz default applications')"
|
al@813
|
48 newline
|
pankso@553
|
49 }
|
pankso@553
|
50
|
al@813
|
51 # try to find icon in .desktop files
|
al@813
|
52 find_icon() {
|
al@813
|
53 local desktop
|
al@813
|
54 desktop=$(find $HOME/.local/share/applications /usr/share/applications \
|
al@813
|
55 -name $1.desktop | head -n1)
|
al@813
|
56 [ x$desktop != x ] && cat $desktop | sed '/\[Desktop\ Entry\]/,/^\[/!d' | \
|
al@813
|
57 sed '/^Icon=/!d' | head -n1 | cut -d= -f2
|
al@813
|
58 }
|
al@813
|
59
|
al@813
|
60 # su frontend GUI's
|
pankso@587
|
61 su_main() {
|
al@813
|
62 CMD1="$1"; shift; CMD2="$(echo $@ | sed 's|&|&|g')"
|
al@813
|
63 : ${icon=$(find_icon $CMD1)}
|
al@813
|
64 [ x$icon == x ] && icon=gtk-dialog-authentication
|
al@813
|
65
|
al@813
|
66 yad --title="$(_n 'SliTaz admin password')" --window-icon=$icon \
|
al@813
|
67 --width=520 --on-top --center \
|
al@813
|
68 --image=$icon --image-on-top \
|
al@813
|
69 --text="$(_n 'Please enter root password (default root) to execute:')\n
|
al@813
|
70 <span foreground=\"red\"><tt><b>$CMD1</b> $CMD2</tt></span>\n" \
|
al@813
|
71 --form \
|
al@813
|
72 --field="$(_n 'Password:'):H" $PASSWD \
|
al@813
|
73 --field="$(_n 'Autosave password'):CHK" $CHECKED
|
pankso@587
|
74 }
|
pankso@587
|
75
|
pankso@587
|
76 su_error() {
|
al@813
|
77 icon=gtk-dialog-error
|
al@813
|
78 yad --title="$(_n 'Error')" --window-icon=$icon \
|
al@813
|
79 --width=320 --on-top --center \
|
al@813
|
80 --image=$icon --image-on-top \
|
al@813
|
81 --text="\n<b>$(_n 'Error: wrong password!')</b>\n" \
|
al@813
|
82 --button="gtk-close:1"
|
pankso@587
|
83 }
|
pankso@587
|
84
|
al@813
|
85 # user may press cancel on download.
|
pankso@562
|
86 cancel_dl() {
|
pankso@562
|
87 if [ "$?" == 1 ]; then
|
al@813
|
88 _ "CANCEL"
|
pankso@562
|
89 rm -f $DOWNLOADS/$(basename $url)
|
pankso@562
|
90 fi
|
pankso@562
|
91 }
|
pankso@562
|
92
|
al@813
|
93 # output a command in a GTK window
|
pankso@744
|
94 output_command() {
|
al@813
|
95 : ${title=$(_n 'TazBox Output')}
|
al@813
|
96 : ${icon=gtk-dialog-info}
|
al@813
|
97
|
al@813
|
98 yad --title="$title" --window-icon=$icon \
|
al@813
|
99 --geometry="600x220+0-24" --fore="#ffffff" --back="#000000" \
|
al@813
|
100 --text-info --fontname=monospace --wrap $opts \
|
al@813
|
101 --button="gtk-close:1"
|
pankso@562
|
102 }
|
pankso@562
|
103
|
al@813
|
104 # logout GUI function
|
pankso@553
|
105 logout_main() {
|
al@813
|
106 icon=system-log-out
|
al@813
|
107 yad --title="$(_n 'SliTaz Logout')" --window-icon=$icon \
|
al@813
|
108 --on-top --center \
|
al@813
|
109 --image=$icon --image-on-top \
|
pankso@814
|
110 --text="<b>$(_n 'Please choose an action:')</b>" \
|
al@813
|
111 --always-print-result \
|
al@813
|
112 --button "$(_n 'Close X session'):4" \
|
al@813
|
113 --button "$(_n 'Reboot system'):3" \
|
al@813
|
114 --button "$(_n 'Shutdown system'):2"
|
al@813
|
115 }
|
pankso@553
|
116
|
al@813
|
117 # generate keymap list
|
pankso@610
|
118 gen_kmap_list() {
|
pankso@610
|
119 echo > $tmp
|
pankso@610
|
120 cd /usr/share/kbd/keymaps/i386
|
al@813
|
121 # we first need a list to sort and then use \n for Yad list.
|
al@813
|
122 for i in $(find -type f | sed '/include/d; s|./||'); do
|
al@813
|
123 echo "$(basename $i .map.gz)|$(dirname $i)" >> $tmp
|
pankso@610
|
124 done
|
pankso@610
|
125 }
|
pankso@610
|
126
|
pankso@610
|
127 # Initial Config functions
|
pankso@610
|
128 setup_main() {
|
al@813
|
129 icon=locale
|
pankso@610
|
130 gen_kmap_list
|
al@813
|
131 locale=$(ls -1 $db | grep ^[a-z][a-z]_[A-Z][A-Z] | tr "\n" "!")
|
al@813
|
132 keymap=$(cat $tmp | sort | tr "\n" "!")
|
al@813
|
133 timezone=$(find $zi -type f | sed s,$zi,,g | tr "\n" "!")
|
al@813
|
134 yad --title="$(_n 'SliTaz Initial Setup')" --window-icon=$icon \
|
al@813
|
135 --width=500 \
|
al@813
|
136 --image=$icon --image-on-top \
|
al@813
|
137 --text="<big>$(_n 'Here you can set your preferences \n for <b>locale, keymap and timezone</b>.')</big>" \
|
al@813
|
138 --form \
|
al@813
|
139 --field "$(_n 'Locale'):CB" $locale \
|
al@813
|
140 --field "$(_n 'Keymap'):CB" $keymap \
|
al@813
|
141 --field "$(_n 'Timezone'):CB" $timezone
|
pankso@610
|
142 }
|
pankso@610
|
143
|
pankso@610
|
144 setup() {
|
pankso@610
|
145 choices=$(setup_main)
|
pankso@610
|
146 locale=$(echo $choices | cut -d"|" -f1)
|
pankso@610
|
147 keymap=$(echo $choices | cut -d"|" -f2)
|
pankso@610
|
148 timezone=$(echo $choices | cut -d"|" -f3)
|
pankso@610
|
149 [ $locale ] && tazlocale init $locale
|
pankso@610
|
150 [ $keymap ] && tazkeymap init $keymap
|
pankso@610
|
151 [ $timezone ] && echo $timezone > /etc/TZ
|
pankso@610
|
152 }
|
pankso@610
|
153
|
pankso@569
|
154 # Locale functions
|
pankso@569
|
155 locale_main() {
|
al@813
|
156 icon=preferences-desktop-locale
|
al@813
|
157 for locale in $(ls -1 $db | grep '[a-z]_[A-Z]'); do
|
al@813
|
158 desc=$(fgrep -m1 title $db/$locale | cut -d'"' -f2)
|
pankso@569
|
159 echo -e "$locale \n $desc"
|
pankso@569
|
160 done | \
|
al@813
|
161 yad --title="$(_n 'SliTaz locale')" --window-icon=$icon \
|
al@813
|
162 --width=600 --height=380 --sticky --on-top --center \
|
al@813
|
163 --image=$icon --image-on-top \
|
al@813
|
164 --text="<b>$(_n 'Language configuration')</b>" \
|
al@813
|
165 --list --column $(_n 'Name') --column $(_n 'Description') \
|
al@813
|
166 --print-column=1 --separator=''
|
pankso@569
|
167 }
|
pankso@569
|
168
|
pankso@569
|
169 locale() {
|
pankso@569
|
170 locale=$(locale_main)
|
pankso@569
|
171 # Deal with --button values
|
pankso@569
|
172 case $? in
|
pankso@569
|
173 1) exit 0 ;;
|
pankso@569
|
174 *) continue ;;
|
pankso@569
|
175 esac
|
pankso@573
|
176 # System language configuration.
|
pankso@752
|
177 [ "$locale" ] && tazlocale $locale
|
pankso@569
|
178 }
|
pankso@569
|
179
|
pankso@569
|
180 # Keymap functions
|
pankso@569
|
181 keymap_main() {
|
al@813
|
182 #icon=preferences-desktop-keyboard
|
al@813
|
183 icon=input-keyboard
|
pankso@610
|
184 gen_kmap_list
|
al@813
|
185 for i in $(sort $tmp); do
|
al@813
|
186 echo "$i" | tr '|' '\n'
|
pankso@569
|
187 done | \
|
al@813
|
188 yad --title="$(_ 'SliTaz keymap')" --window-icon=$icon \
|
al@813
|
189 --width=500 --height=380 --sticky --on-top --center \
|
al@813
|
190 --image=$icon --image-on-top \
|
al@813
|
191 --text="<b>$(_n 'Keyboard configuration')</b>" \
|
al@813
|
192 --list --column $(_n 'Keymap') --column $(_n 'Type') \
|
al@813
|
193 --print-column=1 --separator=''
|
pankso@573
|
194 rm -f $tmp
|
pankso@569
|
195 }
|
pankso@569
|
196
|
pankso@569
|
197 keymap() {
|
pankso@569
|
198 keymap=$(keymap_main)
|
pankso@569
|
199 # Deal with --button values
|
al@813
|
200 [ x$? == x1 ] && exit 0
|
pankso@573
|
201 # System keymap configuration
|
pankso@752
|
202 [ "$keymap" ] && tazkeymap $keymap
|
pankso@569
|
203 }
|
pankso@569
|
204
|
pankso@604
|
205 # TZ functions
|
pankso@604
|
206 tz_main() {
|
al@813
|
207 icon=config-date
|
al@813
|
208 for t in $(find $zi -type f | sed s,$zi,,g); do
|
al@813
|
209 echo -e "$t"
|
al@813
|
210 done | \
|
al@813
|
211 yad --title="$(_ 'SliTaz TZ')" --window-icon=$icon \
|
al@813
|
212 --width=500 --height=380 --sticky --on-top --center \
|
al@813
|
213 --image=$icon --image-on-top \
|
al@813
|
214 --text="<b>$(_n 'TimeZone Configuration')</b>" \
|
al@813
|
215 --list \
|
al@813
|
216 --column $(_n 'Name')
|
al@813
|
217 }
|
al@813
|
218
|
al@813
|
219 tz_select() {
|
al@813
|
220 icon=config-date
|
al@813
|
221 ZONEINFO=/usr/share/zoneinfo
|
al@813
|
222 exit_code=0
|
al@813
|
223
|
al@813
|
224 case x$1 in
|
al@813
|
225 x)
|
al@813
|
226 # first pass - country
|
al@813
|
227 for CC in $(sed '/^#/d; s|^\([^ ]*\).*|\1|' $ZONEINFO/zone.tab | sort -u); do
|
al@813
|
228 cat << EOT
|
al@813
|
229 $CC
|
al@813
|
230 $CC
|
al@813
|
231 $(gettext iso_3166 "$(sed -n 's|^'$CC' \(.*\)$|\1|p' $ZONEINFO/iso3166-1.tab)")
|
al@813
|
232 EOT
|
al@813
|
233 done | \
|
al@813
|
234 yad --title="$(_ 'SliTaz TZ')" --window-icon=$icon \
|
al@813
|
235 --width=500 --height=380 --on-top --center \
|
al@813
|
236 --image=$icon --image-on-top \
|
al@813
|
237 --text="<b>$(_ 'TimeZone Configuration')</b>\n$(_ 'Select country')" \
|
al@813
|
238 --list \
|
al@813
|
239 --column="$(_n 'Flag'):IMG" --column=$(_n 'Code') --column=$(_n 'Country') \
|
al@813
|
240 --button="gtk-index:2" --button="gtk-go-forward:0" \
|
al@813
|
241 --button="gtk-cancel:1" --always-print-result \
|
al@813
|
242 --print-column=2 --separator=''
|
al@813
|
243 ;;
|
al@813
|
244 xindex)
|
al@813
|
245 # manual selection of file with timezone info
|
al@813
|
246 yad --title="$(_ 'SliTaz TZ')" --window-icon=$icon \
|
al@813
|
247 --width=500 --on-top --center \
|
al@813
|
248 --image=$icon --image-on-top \
|
al@813
|
249 --text="<b>$(_ 'TimeZone Configuration')</b>\n$(_ 'Select time zone')" \
|
al@813
|
250 --form --field=":FL" $ZONEINFO/UTC --separator='' | \
|
al@813
|
251 sed "s|$ZONEINFO/||"
|
al@813
|
252 ;;
|
al@813
|
253 *)
|
al@813
|
254 # second pass - city/place
|
al@813
|
255 list=$(cat $ZONEINFO/zone.tab | grep "^$1 " | cut -f3)
|
al@813
|
256 icon=$1
|
al@813
|
257 if [ $(echo "$list" | wc -l) != 1 ]; then
|
al@813
|
258 echo "$list" | \
|
al@813
|
259 yad --title="$(_ 'SliTaz TZ')" --window-icon=$icon \
|
al@813
|
260 --width=500 --height=380 --on-top --center \
|
al@813
|
261 --image=$icon --image-on-top \
|
al@813
|
262 --text="<b>$(_ 'TimeZone Configuration')</b>\n$(_ 'Select location')" \
|
al@813
|
263 --list --column $(_n 'Location/City') --separator=''
|
al@813
|
264 else
|
al@813
|
265 echo $list
|
al@813
|
266 fi
|
al@813
|
267 ;;
|
al@813
|
268 esac
|
pankso@604
|
269 }
|
pankso@604
|
270
|
pankso@604
|
271 tz() {
|
al@813
|
272 timezone=$(tz_select $1)
|
al@813
|
273 case $? in
|
al@813
|
274 1) exit 0 ;;
|
al@813
|
275 0) [ x$timezone == x ] && exit 0
|
al@813
|
276 timezone=$(tz_select "$timezone") ;;
|
al@813
|
277 2) timezone=$(tz_select "index") ;;
|
al@813
|
278 esac
|
al@813
|
279 [ x$timezone == x ] && exit 0
|
al@813
|
280 echo $timezone > /etc/TZ
|
al@813
|
281 export TZ=$timezone
|
pankso@604
|
282 }
|
pankso@604
|
283
|
pankso@632
|
284 # New file functions
|
pankso@632
|
285 newfile_main() {
|
al@813
|
286 icon=gtk-new
|
al@813
|
287 yad --title="$(_n 'New file')" --window-icon=$icon \
|
al@813
|
288 --width=460 --height=160 --on-top --center \
|
al@813
|
289 --image=$icon --image-on-top \
|
al@813
|
290 --text="<b>$(_n 'Create a new file or folder on your desktop')</b>" \
|
al@813
|
291 --entry --entry-label="$(_n 'File name')" \
|
al@813
|
292 --ricon=editclear \
|
al@813
|
293 --always-print-result \
|
al@813
|
294 --button="$(_n 'SHell script'):4" \
|
al@813
|
295 --button="$(_n 'Folder'):3" \
|
al@813
|
296 --icon="gtk-new" \
|
al@813
|
297 --button="$(_n 'File'):2" \
|
pankso@632
|
298 --button="gtk-cancel:1"
|
pankso@632
|
299 }
|
pankso@632
|
300
|
pankso@632
|
301 newfile() {
|
pankso@632
|
302 file=$(newfile_main)
|
pankso@700
|
303 ret=$?
|
pankso@632
|
304 [ "$file" ] || exit 0
|
pankso@700
|
305 case $ret in
|
pankso@700
|
306 4)
|
pankso@632
|
307 cat > $HOME/Desktop/$file << EOT
|
pankso@632
|
308 #!/bin/sh
|
pankso@632
|
309 #
|
pankso@632
|
310
|
pankso@632
|
311 EOT
|
pankso@632
|
312 chmod +x $HOME/Desktop/$file ;;
|
pankso@700
|
313 3) mkdir -p $HOME/Desktop/$file ;;
|
pankso@700
|
314 2) touch $HOME/Desktop/$file ;;
|
pankso@700
|
315 1) exit 0 ;;
|
pankso@632
|
316 esac
|
pankso@632
|
317 }
|
pankso@632
|
318
|
pankso@637
|
319 # All applications
|
pankso@637
|
320 all_apps() {
|
al@813
|
321 icon=stock_bookmark
|
al@813
|
322 yad --title="$(_n 'All Applications')" --window-icon=$icon \
|
al@813
|
323 --width=400 --height=400 \
|
al@813
|
324 --icons --compact \
|
al@813
|
325 --read-dir=/usr/share/applications \
|
pankso@637
|
326 --button="gtk-close:0"
|
pankso@637
|
327 }
|
pankso@637
|
328
|
al@810
|
329 # Generate alternatives list: first - current choice, following - existing apps
|
al@810
|
330 gen_alt() {
|
al@810
|
331 alts="$@"
|
al@810
|
332 current=$(echo $alts | cut -d' ' -f1)
|
al@810
|
333 alts=$(echo $alts | sed "s|$current||g")
|
al@810
|
334 for alt in $alts; do
|
al@810
|
335 [ ! $(busybox which $alt) ] && alts=$(echo $alts | sed "s|$alt||")
|
al@810
|
336 done
|
al@813
|
337 echo $current $alts | tr ' ' '!'
|
al@810
|
338 }
|
al@810
|
339
|
al@813
|
340 # Ask root permissions for system settings
|
al@813
|
341 ask_root() {
|
al@813
|
342 if [ $(id -u) != 0 ]; then
|
al@813
|
343 exec tazbox su $0 $@
|
al@813
|
344 exit 0
|
al@813
|
345 fi
|
al@813
|
346 }
|
al@810
|
347
|
pankso@553
|
348 #
|
pankso@553
|
349 # Commands
|
pankso@553
|
350 #
|
pankso@553
|
351 case "$1" in
|
pankso@553
|
352 su)
|
al@813
|
353 # Don't show dialog if we are root
|
pascal@786
|
354 test $(id -u) = 0 && exec ${@:2}
|
al@813
|
355 SU_CMD="${@:2}"
|
paul@593
|
356 # Check if a password has been saved before launching main dialog
|
pankso@744
|
357 if [ -s $HOME/.config/slitaz/subox.conf ]; then
|
pankso@587
|
358 PASSWD=$(cat $HOME/.config/slitaz/subox.conf)
|
pankso@587
|
359 CHECKED="TRUE"
|
pankso@587
|
360 fi
|
pankso@744
|
361 # Display the main dialog (ask for password)
|
al@813
|
362 main=$(su_main $SU_CMD)
|
paul@593
|
363 # Deal with --button values and exit if cancelled to avoid erasing
|
pankso@587
|
364 # saved password.
|
al@813
|
365 [ $? == 1 ] && exit 0
|
pankso@587
|
366 # Save or erase Autosaved password
|
pankso@744
|
367 if [ $(echo $main | cut -f2 -d"|") == "TRUE" ]; then
|
pankso@587
|
368 echo $main | cut -f 1 -d "|" > $HOME/.config/slitaz/subox.conf
|
pankso@744
|
369 chmod 0600 $HOME/.config/slitaz/subox.conf
|
pankso@587
|
370 else
|
pankso@587
|
371 cat /dev/null > $HOME/.config/slitaz/subox.conf
|
pankso@587
|
372 fi
|
pankso@744
|
373 # Try to login & execute. If password is wrong execute error dialog
|
al@813
|
374 SU_CMD_QUOTED="$(echo "$SU_CMD" | sed 's|&|\\&|g')"
|
al@813
|
375 echo "SU_CMD«$SU_CMD» SU_CMD_QUOTED«$SU_CMD_QUOTED»"
|
al@813
|
376 echo $main | cut -f 1 -d "|" | su -c "$SU_CMD_QUOTED &" || su_error ;;
|
pankso@553
|
377 logout)
|
paul@593
|
378 # Logout window with actions
|
al@813
|
379 if [ "$oldstyle" ]; then
|
al@813
|
380 answer=$(logout_oldstyle)
|
al@813
|
381 else
|
al@813
|
382 logout_main; answer=$?
|
al@813
|
383 fi
|
pankso@553
|
384 # Deal with --button values
|
paul@763
|
385 # DE and WM started with a custom -session script should export
|
pankso@736
|
386 # XDG_CURRENT_DESKTOP
|
al@813
|
387 case $answer in
|
al@813
|
388 4|*exit)
|
pankso@736
|
389 case $XDG_CURRENT_DESKTOP in
|
pankso@736
|
390 LXDE)
|
pankso@736
|
391 [ "$_LXSESSION_PID" ] && kill $_LXSESSION_PID
|
al@813
|
392 [ "$DESKTOP_SESSION" == "compiz" ] && killall compiz
|
pankso@736
|
393 openbox --exit ;;
|
pankso@736
|
394 openbox) openbox --exit ;;
|
pankso@736
|
395 compiz) killall compiz ;;
|
pankso@736
|
396 *)
|
pankso@736
|
397 # Try to kill other WM that dont set XDG var.
|
pankso@736
|
398 jwm -exit 2>/dev/null ;;
|
pankso@736
|
399 esac ;;
|
al@813
|
400 3|*reboot)
|
al@813
|
401 reboot || reboot -f ;;
|
al@813
|
402 2|*halt)
|
al@813
|
403 poweroff ;;
|
pankso@553
|
404 esac ;;
|
pankso@562
|
405 out)
|
pankso@562
|
406 # Pipe a command into a GTK window
|
al@813
|
407 sed 's|\[.m||g; s|\[[0-9][0-9]*G| |g' | output_command ;;
|
paul@593
|
408 out-dl)
|
pankso@562
|
409 # A tiny GTK window for Busybox wget output
|
al@813
|
410 url=$2; opts="--tail --button=gtk-cancel:1"
|
al@813
|
411 icon=folder-downloads; title="$(_ 'Downloading...')"
|
slaxemulator@594
|
412 [ -d $DOWNLOADS ] || mkdir -p $DOWNLOADS
|
pascal@648
|
413 busybox wget -c -P $DOWNLOADS $url 2>&1 | output_command
|
pankso@562
|
414 cancel_dl ;;
|
pankso@569
|
415 locale)
|
al@813
|
416 ask_root $@ && locale ;;
|
pankso@569
|
417 keymap)
|
al@813
|
418 ask_root $@ && keymap ;;
|
al@813
|
419 tz)
|
al@813
|
420 ask_root $@ && tz $2;;
|
al@813
|
421 setup)
|
al@813
|
422 ask_root $@ && setup ;;
|
pankso@632
|
423 new-file)
|
pankso@632
|
424 newfile ;;
|
pankso@637
|
425 all-apps)
|
pankso@637
|
426 all_apps ;;
|
pankso@689
|
427 notify|-n)
|
pankso@689
|
428 # On screen notification box.
|
pankso@721
|
429 icon="$3"
|
pankso@721
|
430 time="$4"
|
pankso@721
|
431 [ "$icon" ] || icon=info
|
pankso@689
|
432 [ "$time" ] || time=4
|
al@813
|
433 yad --width=520 --height=80 --timeout=$time --timeout-indicator=right \
|
al@813
|
434 --on-top --center --no-buttons --borders=12 --undecorated \
|
al@813
|
435 --skip-taskbar --image=$icon --image-on-top --text="<b>$2</b>" ;;
|
al@807
|
436 tazapps)
|
al@807
|
437 # Default applications configuration script. System wide config file
|
al@807
|
438 # is /etc/slitaz/applications.conf and each user can have personal
|
al@807
|
439 # settings. System wide for root and personal config for user.
|
al@807
|
440 export CONFIG="$HOME/.config/slitaz/applications.conf"
|
al@807
|
441 if [ ! -f $CONFIG ]; then
|
al@807
|
442 mkdir -p $HOME/.config/slitaz
|
al@807
|
443 cp /etc/slitaz/applications.conf $CONFIG
|
al@807
|
444 fi
|
al@807
|
445 . $CONFIG
|
al@810
|
446
|
al@810
|
447 FILE_MANAGERS=$(gen_alt $FILE_MANAGER \
|
al@810
|
448 clex emelfm2 mc pathfinder pcmanfm ranger spacefm thunar xfe ytree)
|
al@810
|
449 BROWSERS=$(gen_alt $BROWSER \
|
al@810
|
450 arora chrome cream dillo elinks firefox iron links lynx midori \
|
al@810
|
451 netsurf opera retawq seamonkey surf tazweb)
|
al@810
|
452 EDITORS=$(gen_alt $EDITOR \
|
al@810
|
453 adie beaver emacs geany jed joe le leafpad mousepad mp-5 nano \
|
al@810
|
454 SciTE vi vim xedit xfw zile)
|
al@810
|
455 TERMINALS=$(gen_alt $TERMINAL \
|
al@810
|
456 aterm evilvte lxterminal mrxvt sakura stjerm tilda urxvt vte xterm \
|
al@810
|
457 yeahconsole)
|
al@810
|
458 WINDOW_MANAGERS=$(gen_alt $WINDOW_MANAGER \
|
al@810
|
459 awesome blackbox dwm echinus enlightenment fluxbox icewm jwm \
|
al@810
|
460 karmen matchbox openbox-session pekwm ratpoison xfwm4)
|
al@810
|
461
|
al@813
|
462 icon=preferences-desktop-default-applications
|
al@813
|
463 eval $(yad --title="$(_n 'SliTaz default applications')" \
|
al@813
|
464 --window-icon=$icon --image=$icon --image-on-top \
|
al@813
|
465 --text="<b>$(_n 'SliTaz default applications configuration')</b>" \
|
al@807
|
466 --form \
|
al@813
|
467 --field="$(_n 'File manager:'):CBE" "$FILE_MANAGERS" \
|
al@813
|
468 --field="$(_n 'Web browser:'):CBE" "$BROWSERS" \
|
al@813
|
469 --field="$(_n 'Text editor:'):CBE" "$EDITORS" \
|
al@813
|
470 --field="$(_n 'Terminal:'):CBE" "$TERMINALS" \
|
al@813
|
471 --field="$(_n 'Window manager:'):CBE" "$WINDOW_MANAGERS" | \
|
al@807
|
472 awk -F'|' '{printf "FILE_MANAGER=\"%s\"\nBROWSER=\"%s\"\nEDITOR=\"%s\"\
|
al@807
|
473 TERMINAL=\"%s\"\nWINDOW_MANAGER=\"%s\"\n", $1, $2, $3, $4, $5}')
|
al@810
|
474
|
al@807
|
475 sed '/FILE_MANAGER=/s|"\([^"]*\)"|"'$FILE_MANAGER'"|; \
|
al@807
|
476 /BROWSER=/s|"\([^"]*\)"|"'$BROWSER'"|; \
|
al@807
|
477 /EDITOR=/s|"\([^"]*\)"|"'$EDITOR'"|; \
|
al@807
|
478 /TERMINAL=/s|"\([^"]*\)"|"'$TERMINAL'"|; \
|
al@807
|
479 /WINDOW_MANAGER=/s|"\([^"]*\)"|"'$WINDOW_MANAGER'"|' \
|
al@810
|
480 -i $CONFIG ;;
|
al@807
|
481 gpl)
|
al@813
|
482 yad --title="GNU General Public License" --window-icon=text-x-generic \
|
al@813
|
483 --geometry="650x500" \
|
al@810
|
484 --image=/usr/share/pixmaps/gpl3.png --image-on-top \
|
al@813
|
485 --center \
|
al@813
|
486 --text-info \
|
al@813
|
487 --fontname=monospace \
|
al@813
|
488 --button "OK" < /usr/share/licenses/gpl.txt ;;
|
pankso@553
|
489 *)
|
pankso@553
|
490 usage ;;
|
pankso@553
|
491 esac
|
pankso@553
|
492
|
pankso@553
|
493 exit 0
|