diff --git a/settings b/settings index 7bf49f7..aa1038c 100755 --- a/settings +++ b/settings @@ -28,10 +28,9 @@ if [ "$1" == 'refresh' ];then done IFS="$PREIFS" exit 0 -fi - -#$1 is usually left blank. If it equals 'revert', then overwrite all settings with the defaults and then the script will exit. -if [ "$1" == 'revert' ];then + +elif [ "$1" == 'revert' ];then #If $1 equals 'revert', then overwrite all settings with the defaults and then the script will exit. + #overwrite all settings with the defaults settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')" PREIFS="$IFS" @@ -61,8 +60,8 @@ exitloop='' while [ -z $exitloop ];do settings="$(ls "${DIRECTORY}/etc/setting-params" | tr '\n' '|')" - yadparams='' - tooltips='' + yadparams=() + tooltips=() PREIFS="$IFS" IFS='|' for name in $settings @@ -88,25 +87,17 @@ $(echo "$params" | grep -vx "$curval")" #echo "Params of ${name}: ${params}" #echo "Tooltip of ${name}: ${tooltip}" - yadparams="${yadparams} ---field=:CB -${params}" - tooltips="${tooltips} ---field=${name}:!!${tooltip}:BTN -''" + yadparams+=(--field=:CB "${params}") + tooltips+=(--field="${name}":!!"${tooltip}":BTN '') done IFS="$PREIFS" - #replace all space ' ' characters with a special kind of space: a punctuation space ( ). This way, bash won't split the strings into separate words. - yadparams="$(echo "$yadparams" | sed 's/ / /g')" - tooltips="$(echo "$tooltips" | sed 's/ / /g')" - output="$(yad --center --title='Pi-Apps Settings' --width=310 --height=300 \ --form --separator='\n' --window-icon="${DIRECTORY}/icons/logo.png" --columns=2 \ - $tooltips \ + "${tooltips[@]}" \ --field='Categories...'!"${DIRECTORY}/icons/categories.png":FBTN "bash -c '${DIRECTORY}/etc/categoryedit &>/dev/null'" \ --field='Log files...'!"${DIRECTORY}/icons/log-file.png":FBTN "bash -c '${DIRECTORY}/etc/logviewer &>/dev/null'" \ - $yadparams \ + "${yadparams[@]}" \ --field='New App...'!"${DIRECTORY}/icons/create.png":FBTN "bash -c '${DIRECTORY}/createapp &>/dev/null'" \ --button='Reset'!"${DIRECTORY}/icons/backup.png"!'Reset all settings to their defaults':2 \ --button=Cancel!"${DIRECTORY}/icons/exit.png":1 \