mirror of
https://github.com/erenfro/xfconf.git
synced 2024-12-26 16:03:21 -05:00
Corrected integer, boolean, and empty values.
This commit is contained in:
parent
db41b2dc81
commit
daa716ff1b
1 changed files with 26 additions and 1 deletions
27
xfconf.sh
27
xfconf.sh
|
@ -81,8 +81,33 @@ function loadConfig {
|
|||
*last-show-hidden|*misc-single-click) _thistype=bool ;;
|
||||
esac
|
||||
|
||||
shopt -s extglob
|
||||
if [[ "$value" == "<<UNSUPPORTED>>" ]]; then
|
||||
continue
|
||||
elif [[ "$value" == "true" || "$value" == "false" ]]; then
|
||||
_thistype=bool
|
||||
elif [[ -z "$value" ]]; then
|
||||
value='""'
|
||||
elif [[ $value = @(*[0123456789]*|!([+-]|)) && $value = ?([+-])*([0123456789]) ]]; then
|
||||
_thistype=int
|
||||
elif [[ $value = @(*[0123456789]*|!([+-]|)) && $value = ?([+-])*([0123456789])?(.*([0123456789])) ]]; then
|
||||
_thistype=double
|
||||
fi
|
||||
|
||||
# make change
|
||||
env DISPLAY="${DISPLAY}" DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS}" ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}"
|
||||
if [[ "$_thistype" == "string" ]]; then
|
||||
#echo ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}"
|
||||
output="$(env DISPLAY="${DISPLAY}" DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS}" ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}" 2>&1)"
|
||||
if [[ "$output" == "Unable to determine the type of the value." ]]; then
|
||||
echo ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}"
|
||||
fi
|
||||
else
|
||||
#echo ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}"
|
||||
output="$(env DISPLAY="${DISPLAY}" DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS}" ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}" 2>&1)"
|
||||
if [[ "$output" == "Unable to determine the type of the value." ]]; then
|
||||
echo ${thisDEconf} --create -t ${_thistype} -c "${channel}" -p "${attrib}" -s "${value}"
|
||||
fi
|
||||
fi
|
||||
#sudo su - "${thisowner}" -c "DISPLAY=${DISPLAY} DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS} ${thisDEconf} --create -t ${_thistype} -c ${channel} -p ${attrib} -s ${value}"
|
||||
done < <(grep -viE '^\s*((#|;).*)?$' "${infile}")
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue