Corrected a huge mistake in the checkout_config method

This commit is contained in:
Karma Riuk 2021-03-07 23:22:17 +01:00
parent 15a310975e
commit 0cd51db328

View File

@ -50,13 +50,18 @@ get_parser_location () {
checkout_config () { checkout_config () {
local parser_location="$(get_parser_location)" local parser_location="$(get_parser_location)"
[[ -z "$parser_location" ]] && verbose && echo "Unable to find the 'read_ini.sh' file, which is used to read the config file. Will be using the default vlaues of the script." && return 0 if [[ ! -z "$parser_location" ]]; then
verbose && echo "Sourcing the ini parser"
verbose && echo "Sourcing the ini parser" source "$parser_location"
source "$parser_location" if [[ -f "$CONFIG_PATH" ]]; then
verbose && echo "Reading the config file '$CONFIG_PATH'"
verbose && echo "Reading the config file" read_ini "$CONFIG_PATH"
read_ini "$CONFIG_PATH" else
verbose && echo "Unable to find the config file '$CONFIG_PATH', using default script values"
fi
else
verbose && echo "Unable to find the 'read_ini.sh' file, which is used to read the config file. Will be using the default vlaues of the script."
fi
BRIGHTNESS_CONTROLLER=${INI__Controller__brightness_controller:-$DEFAULT_BRIGHTNESS_CONTROLLER} BRIGHTNESS_CONTROLLER=${INI__Controller__brightness_controller:-$DEFAULT_BRIGHTNESS_CONTROLLER}
INCREASE_FLAG=${INI__Controller__increase_flag:-$DEFAULT_INCREASE_FLAG} INCREASE_FLAG=${INI__Controller__increase_flag:-$DEFAULT_INCREASE_FLAG}
@ -73,20 +78,20 @@ checkout_config () {
NOTIFICATION_ENABLED=${INI__Notification__enabled:-$DEFAULT_NOTIFICATION_ENABLED} NOTIFICATION_ENABLED=${INI__Notification__enabled:-$DEFAULT_NOTIFICATION_ENABLED}
NOTIFICATION_TIMEOUT=${INI__Notification__timeout:-$DEFAULT_NOTIFICATION_TIMEOUT} NOTIFICATION_TIMEOUT=${INI__Notification__timeout:-$DEFAULT_NOTIFICATION_TIMEOUT}
verbose && echo "" && echo "After parsing the config file, variables are:" && \ verbose && echo "" && echo "Variables are:" && \
echo "BRIGHTNESS_CONTROLLER: '$BRIGHTNESS_CONTROLLER'" && \ echo "BRIGHTNESS_CONTROLLER: '$BRIGHTNESS_CONTROLLER'" && \
echo "INCREASE_FLAG: '$INCREASE_FLAG'" && \ echo "INCREASE_FLAG: '$INCREASE_FLAG'" && \
echo "DECREASE_FLAG: '$DECREASE_FLAG'" && \ echo "DECREASE_FLAG: '$DECREASE_FLAG'" && \
echo "SET_BRIGHTNESS_FLAG: '$SET_BRIGHTNESS_FLAG'" && \ echo "SET_BRIGHTNESS_FLAG: '$SET_BRIGHTNESS_FLAG'" && \
echo "GET_BRIGHTNESS_FLAG: '$GET_BRIGHTNESS_FLAG'" && \ echo "GET_BRIGHTNESS_FLAG: '$GET_BRIGHTNESS_FLAG'" && \
echo "ADDITIONAL_FLAGS: '$ADDITIONAL_FLAGS'" && \ echo "ADDITIONAL_FLAGS: '$ADDITIONAL_FLAGS'" && \
echo "NORMAL_DELTA: '$NORMAL_DELTA'" && \ echo "NORMAL_DELTA: '$NORMAL_DELTA'" && \
echo "BIG_DELTA: '$BIG_DELTA'" && \ echo "BIG_DELTA: '$BIG_DELTA'" && \
echo "BRIGTHNESS_MAX: '$BRIGTHNESS_MAX'" && \ echo "BRIGTHNESS_MAX: '$BRIGTHNESS_MAX'" && \
echo "BRIGTHNESS_MIN: '$BRIGTHNESS_MIN'" && \ echo "BRIGTHNESS_MIN: '$BRIGTHNESS_MIN'" && \
echo "NOTIFICATION_ENABLED: '$NOTIFICATION_ENABLED'" && \ echo "NOTIFICATION_ENABLED: '$NOTIFICATION_ENABLED'" && \
echo "NOTIFICATION_TIMEOUT: '$NOTIFICATION_TIMEOUT'" && \ echo "NOTIFICATION_TIMEOUT: '$NOTIFICATION_TIMEOUT'" && \
echo "" echo ""
} }
@ -94,7 +99,7 @@ notify () {
local brightness=$(get_brightness | sed 's/\..*$//') local brightness=$(get_brightness | sed 's/\..*$//')
local cmd="dunstify -h int:value:$brightness -t $NOTIFICATION_TIMEOUT -h string:x-dunst-stack-tag:volume -i \"xfpm-brightness-lcd\" \"Brightness ($brightness%)\"" local cmd="dunstify -h int:value:$brightness -t $NOTIFICATION_TIMEOUT -h string:x-dunst-stack-tag:volume -i \"xfpm-brightness-lcd\" \"Brightness ($brightness%)\""
[[ $NOTIFICATION_ENABLED -eq 1 ]] && sh -c "$cmd" [[ $NOTIFICATION_ENABLED -eq 1 ]] && sh -c "$cmd"
verbose && ( [[ $NOTIFICATION_ENABLED -eq 1 ]] && echo "Notified with \`$cmd\`" || echo "Didn't notify" ) # verbose && ( [[ $NOTIFICATION_ENABLED -eq 1 ]] && echo "Notified with \`$cmd\`" || echo "Didn't notify" )
} }
brightness_up_by () { brightness_up_by () {