slitaz-tools annotate tinyutils/terminal @ rev 926
slitaz-config: connect to hidden Wi-Fi; browser, editor, file-manager, terminal: use XDG variable if possible; tazx: code simplification and many small improvements; translations: make pot, msgmerge.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Nov 20 06:04:24 2014 +0200 (2014-11-20) |
parents | e232f0e1413a |
children | 5d80f6fdbdb7 |
rev | line source |
---|---|
pankso@335 | 1 #!/bin/sh |
paul@725 | 2 # Launch SliTaz default X Terminal. |
pankso@335 | 3 # |
pankso@335 | 4 . /etc/slitaz/applications.conf |
al@810 | 5 . /lib/libtaz.sh |
al@813 | 6 export TEXTDOMAIN='slitaz-tools' #i18n |
al@810 | 7 |
al@810 | 8 help() { |
al@810 | 9 cat << EOT |
al@813 | 10 $(boldify terminal): $(_n 'configurable SliTaz wrapper for terminal.') |
al@810 | 11 |
al@813 | 12 $(boldify $(_n 'Recognized options:')) |
al@813 | 13 -v -version --version $(_n 'Print the version number') |
al@813 | 14 -help --help $(_n 'Print out this message') |
al@813 | 15 -geometry --geometry $(_n 'Width and height of terminal window ($GEOMETRY)') |
al@813 | 16 -t -title -T --title $(_n 'Title name for window ("$TITLE")') |
al@813 | 17 -h -hold $(_n "Don't close terminal after command finished") |
al@813 | 18 -e --xterm-execute $(_n 'Command to execute (must be last in line)') |
al@810 | 19 |
al@810 | 20 |
al@813 | 21 $(boldify $(_n 'Help for $TERMINAL:')) |
al@810 | 22 |
al@810 | 23 EOT |
al@810 | 24 $TERMINAL $OPT_HELP |
al@810 | 25 } |
al@810 | 26 |
pankso@335 | 27 |
al@926 | 28 USER_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/slitaz/applications.conf" |
pankso@335 | 29 [ -f $USER_CONFIG ] && . $USER_CONFIG |
pankso@335 | 30 |
al@810 | 31 local PARAMS="" GEOMETRY="80x24" TITLE="SliTaz $(cat /etc/slitaz-release)" COMMAND |
al@810 | 32 |
al@810 | 33 case $TERMINAL in |
al@810 | 34 sakura) |
al@810 | 35 OPT_TITLE="-t"; OPT_GEOM="--geometry"; OPT_HELP="-?"; OPT_HOLD="-h";; |
al@810 | 36 xterm|*) |
al@810 | 37 OPT_TITLE="-T"; OPT_GEOM="-geometry"; OPT_HELP="-help"; OPT_HOLD="-hold";; |
al@810 | 38 esac |
al@810 | 39 |
al@810 | 40 until [ $# == 0 ]; do |
al@810 | 41 PARAM="$1" |
al@810 | 42 case "$PARAM" in |
al@810 | 43 -version|--version|-v) $TERMINAL -v; exit 0;; |
al@810 | 44 -help|--help) help; exit 0;; |
al@810 | 45 -h|-hold) shift; PARAMS="$PARAMS $OPT_HOLD";; |
al@810 | 46 -geometry|--geometry) shift; GEOMETRY="$1"; shift;; |
al@810 | 47 -t|-title|-T|--title) shift; TITLE="$1"; shift;; |
al@810 | 48 -e|--xterm-execute) shift; COMMAND="-e $@"; break;; |
al@810 | 49 *) shift; PARAMS="$PARAMS $PARAM";; |
al@810 | 50 esac |
al@810 | 51 done |
al@810 | 52 |
al@810 | 53 $TERMINAL $PARAMS $OPT_GEOM $GEOMETRY $OPT_TITLE "$TITLE" $COMMAND & |
pankso@335 | 54 |
pankso@335 | 55 exit 0 |