diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index f48651c..a49794c 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -5433,15 +5433,18 @@ portwine_create_shortcut () { for df in "${DESKTOP_FILES_ARRAY[@]}" ; do df="${df//"$PORT_WINE_PATH/"/}" df="${df//.desktop/}" - if [[ ${PORTWINE_DB^^} =~ ${df^^} ]] + if [[ ${PORTWINE_DB^^} =~ ${df^^} ]] && [[ ${PORTWINE_DB^^} != ${df^^} ]] then name_desktop="$df" fi done fi if [[ -z $name_desktop ]] ; then - if [[ -n $PORTPROTON_NAME ]] - then name_desktop="$PORTPROTON_NAME" - else name_desktop="$PORTWINE_DB" + if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] \ + && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] + then + name_desktop="$PORTPROTON_NAME" + else + name_desktop="$PORTWINE_DB_NEW" fi fi export name_desktop @@ -5492,7 +5495,7 @@ portwine_create_shortcut () { edit_user_conf_from_gui PW_SHORTCUT_MENU PW_SHORTCUT_DESKTOP PW_SHORTCUT_STEAM - if [[ -n ${DESKTOP_FILES_ARRAY[1]} ]] ; then + if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] && [[ $name_desktop != $df ]] || [[ -n ${DESKTOP_FILES_ARRAY[1]} ]] ; then if yad_question "${translations[A higher number of duplicate desktop files were found for this file.\\nShould I delete the extra ones or not?]}" ; then for rm in "${DESKTOP_FILES_ARRAY[@]}" ; do rm -f "$rm" diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index 380f03f..5475fbc 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -502,10 +502,40 @@ if [[ -f "${portwine_exe}" ]] ; then [[ $DESKTOP_WITH_TIME == enabled ]] && search_desktop_file if [[ -z "${PW_COMMENT_DB}" ]] ; then - if [[ -n "${PORTPROTON_NAME}" ]] ; then + if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] ; then PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "${PORTPROTON_NAME}" "50")$(seconds_to_time "$TIME_CURRENT")" else - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "${PORTWINE_DB}" "50")$(seconds_to_time "$TIME_CURRENT")" + unset PORTWINE_DB_PROXY PORTWINE_DB_NEW + PORTWINE_DB="${PORTWINE_DB//_/ }" + if [[ ${PORTWINE_DB:0:1} =~ [a-z] ]] ; then + PORTWINE_DB_UPPER="${PORTWINE_DB^^}" + PORTWINE_DB="${PORTWINE_DB_UPPER:0:1}${PORTWINE_DB:1}" + fi + if (( ${#PORTWINE_DB} > 2 )) ; then + for ((i=0 ; i<${#PORTWINE_DB} ; i++)) ; do + if [[ ${PORTWINE_DB:i:2} =~ ([a-z][A-Z]|[a-z][0-9]) ]] \ + && [[ ! ${PORTWINE_DB:i:3} =~ ([a-z][A-Z]" "|[a-z][0-9]" ") ]] ; then + PORTWINE_DB_PROXY+="${PORTWINE_DB:i:1} " + elif [[ ${PORTWINE_DB:i:3} =~ [0-9][0-9][a-zA-Z] ]] ; then + PORTWINE_DB_PROXY+="${PORTWINE_DB:i:2} " + ((i++)) + else + PORTWINE_DB_PROXY+="${PORTWINE_DB:i:1}" + fi + done + for ((i=0 ; i<${#PORTWINE_DB_PROXY} ; i++)) ; do + if [[ ${PORTWINE_DB_PROXY:i:2} =~ " "[a-z] ]] ; then + PORTWINE_DB_UPPER="${PORTWINE_DB_PROXY:i:2}" + PORTWINE_DB_NEW+="${PORTWINE_DB_UPPER^^}" + ((i++)) + else + PORTWINE_DB_NEW+="${PORTWINE_DB_PROXY:i:1}" + fi + done + else + PORTWINE_DB_NEW="$PORTWINE_DB" + fi + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "${PORTWINE_DB_NEW}" "50")$(seconds_to_time "$TIME_CURRENT")" fi else PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")" @@ -639,7 +669,7 @@ else if [[ $SORT_WITH_TIME == enabled ]] && [[ $NEW_DESKTOP == 1 ]] ; then unset NEW_DESKTOP sed -i '/^#NEW_DESKTOP/d' "$desktop_file" - PW_AMOUNT_NEW_DESKTOP=($AMOUNT_GENERATE_BUTTONS) + PW_AMOUNT_NEW_DESKTOP+=($AMOUNT_GENERATE_BUTTONS) else PW_AMOUNT_OLD_DESKTOP+=($AMOUNT_GENERATE_BUTTONS) fi