Using + instead of \ in MANGOHUD_FPS_LIMIT

This commit is contained in:
Boria138
2024-01-30 19:17:53 +06:00
parent dd8f0f15e2
commit 2c098b75ee
2 changed files with 5 additions and 23 deletions

View File

@@ -1047,23 +1047,6 @@ edit_db_from_gui () {
return 0 return 0
} }
edit_mh_config_from_gui () {
print_info "edit_mh_config_from_gui MANGOHUD_CONFIG=$MANGOHUD_CONFIG"
for mod_db in $@ ; do
escaped_value=$(printf "%s" "${!mod_db}" | sed 's/\\/\\\\/g; s/,/\\,/g')
if [ -z "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" ] ; then
echo "export ${mod_db}=\"${escaped_value}\"" >> "${PORTWINE_DB_FILE}"
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" ] ; then
if [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}=" | grep -v "#"`" != "export ${mod_db}=\"${escaped_value}\"" ] ; then
sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/" "${PORTWINE_DB_FILE}"
fi
elif [ "`cat "${PORTWINE_DB_FILE}" | grep "export ${mod_db}="`" != "export ${mod_db}=${escaped_value}" ] ; then
sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"${escaped_value}\"/g" "${PORTWINE_DB_FILE}"
fi
done
return 0
}
edit_user_conf_from_gui () { edit_user_conf_from_gui () {
for mod_db in $@ ; do for mod_db in $@ ; do
print_info "${mod_db}=${!mod_db}" print_info "${mod_db}=${!mod_db}"

View File

@@ -594,15 +594,15 @@ gui_MangoHud () {
export INT_COUNT_MH_FPS=0 export INT_COUNT_MH_FPS=0
for read_list_mh_fps in ${YAD_MH_FPS_LIMIT} ; do for read_list_mh_fps in ${YAD_MH_FPS_LIMIT} ; do
if [[ "$read_list_mh_fps" == "TRUE" ]] if [[ "$read_list_mh_fps" == "TRUE" ]]
then export GUI_MH_FPS_RESULT+="${GET_REFRESH_RATE[$INT_COUNT_MH_FPS]}\," then export GUI_MH_FPS_RESULT+="${GET_REFRESH_RATE[$INT_COUNT_MH_FPS]}+"
fi fi
((INT_COUNT_MH_FPS++)) ((INT_COUNT_MH_FPS++))
done done
GUI_MH_FPS_RESULT="${GUI_MH_FPS_RESULT}" GUI_MH_FPS_RESULT="${GUI_MH_FPS_RESULT}"
if [ "$(echo "${GUI_MH_FPS_RESULT}" | awk -F',' '{print $2}')" ] if [ "$(echo "${GUI_MH_FPS_RESULT}" | awk -F'+' '{print $2}')" ]
then export PW_FPS_LIMIT="0\,${GUI_MH_FPS_RESULT%\\,}" then export PW_FPS_LIMIT="0+${GUI_MH_FPS_RESULT%+}"
else export PW_FPS_LIMIT="${GUI_MH_FPS_RESULT%\\,}" else export PW_FPS_LIMIT="${GUI_MH_FPS_RESULT%+}"
fi fi
if [[ -n "$MH_FONT_SIZE" ]] if [[ -n "$MH_FONT_SIZE" ]]
@@ -619,8 +619,7 @@ gui_MangoHud () {
export MANGOHUD_CONFIG="${GUI_MH_RESULT}" export MANGOHUD_CONFIG="${GUI_MH_RESULT}"
edit_db_from_gui PW_MANGOHUD PW_FPS_LIMIT edit_db_from_gui PW_MANGOHUD PW_FPS_LIMIT MANGOHUD_CONFIG
edit_mh_config_from_gui MANGOHUD_CONFIG
/usr/bin/env bash -c "${pw_full_command_line[*]}" & /usr/bin/env bash -c "${pw_full_command_line[*]}" &
exit 0 exit 0
} }