From bd2f9fb1e63b029bb7adfae364e751fb27d83110 Mon Sep 17 00:00:00 2001 From: Htylol Date: Wed, 23 Oct 2024 14:57:38 +0500 Subject: [PATCH] Updates --- data_from_portwine/scripts/functions_helper | 75 +++++++++++++++++++-- data_from_portwine/scripts/start.sh | 65 +----------------- 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 41ec3886..967258f1 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -873,6 +873,73 @@ search_desktop_file () { fi } +create_pw_comment () { + search_desktop_file + unset DESKTOP_NAME_FILE PW_SHORTCUT_PROXY + if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] ; then + for df in "${DESKTOP_FILES_ARRAY[@]}" ; do + df="${df//"$PORT_WINE_PATH/"/}" + DESKTOP_NAME_FILE="${df//.desktop/}" + done + fi + if [[ -z "${PW_COMMENT_DB}" ]] ; then + [[ $FILE_DESCRIPTION != "" ]] && FILE_DESCRIPTION_ABBR=$(make_abbreviation "$FILE_DESCRIPTION") + [[ $PORTPROTON_NAME != "" ]] && PORTPROTON_NAME_ABBR=$(make_abbreviation "$PORTPROTON_NAME") + if [[ -n $DESKTOP_NAME_FILE ]] && [[ $DESKTOP_NAME_FILE != "" ]] ; then + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$DESKTOP_NAME_FILE" "50")$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE" + elif [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] ; then + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$PORTPROTON_NAME" "50")$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$PORTPROTON_NAME" + elif (( ${#PORTPROTON_NAME_ABBR} > 2 )) && [[ ${PORTPROTON_NAME_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$PORTPROTON_NAME" "50")$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$PORTPROTON_NAME" + elif [[ ${FILE_DESCRIPTION^^} =~ ${PORTWINE_DB^^} ]] && [[ ${FILE_DESCRIPTION^^} != "${PORTWINE_DB^^}" ]] ; then + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$FILE_DESCRIPTION" "50")$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$FILE_DESCRIPTION" + elif (( ${#FILE_DESCRIPTION_ABBR} > 2 )) && [[ ${FILE_DESCRIPTION_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then + PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$FILE_DESCRIPTION" "50")$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$FILE_DESCRIPTION" + else + 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} > 3 )) ; 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")" + PW_SHORTCUT_PROXY="$PORTWINE_DB_NEW" + fi + else + PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE" + fi +} + # Конвертация секунд в дни, часы, минуты seconds_to_time () { [[ ! $DESKTOP_WITH_TIME == enabled ]] && return 0 @@ -5435,11 +5502,7 @@ portwine_create_shortcut () { [[ -z "${PW_SHORTCUT_DESKTOP}" ]] && PW_SHORTCUT_DESKTOP="TRUE" [[ -z "${PW_SHORTCUT_STEAM}" ]] && PW_SHORTCUT_STEAM="FALSE" - if [[ -n $PW_SHORTCUT_PROXY ]] - then name_desktop="$PW_SHORTCUT_PROXY" - else name_desktop="$PORTWINE_DB" - fi - export name_desktop + [[ -z $PW_SHORTCUT_PROXY ]] && create_pw_comment && export name_desktop="$PW_SHORTCUT_PROXY" [[ -z "${name_desktop_png}" ]] && name_desktop_png="${PORTPROTON_NAME// /_}" @@ -5492,7 +5555,7 @@ portwine_create_shortcut () { for rm in "${DESKTOP_FILES_ARRAY[@]}" ; do rm -f "$rm" done - name_desktop="$PW_SHORTCUT_PROXY" + [[ $name_desktop == "" ]] && create_pw_comment && export name_desktop="$PW_SHORTCUT_PROXY" fi else try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop" diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index f081ccd0..7491bf90 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -500,70 +500,7 @@ if [[ -f "${portwine_exe}" ]] ; then PW_SHORTCUT="${translations[DELETE SHORTCUT]}!$PW_GUI_ICON_PATH/$BUTTON_SIZE.png!${translations[Delete shortcut for select file...]}:98" fi - search_desktop_file - unset DESKTOP_NAME_FILE PW_SHORTCUT_PROXY - if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] ; then - for df in "${DESKTOP_FILES_ARRAY[@]}" ; do - df="${df//"$PORT_WINE_PATH/"/}" - DESKTOP_NAME_FILE="${df//.desktop/}" - done - fi - if [[ -z "${PW_COMMENT_DB}" ]] ; then - [[ $FILE_DESCRIPTION != "" ]] && FILE_DESCRIPTION_ABBR=$(make_abbreviation "$FILE_DESCRIPTION") - [[ $PORTPROTON_NAME != "" ]] && PORTPROTON_NAME_ABBR=$(make_abbreviation "$PORTPROTON_NAME") - if [[ -n $DESKTOP_NAME_FILE ]] && [[ $DESKTOP_NAME_FILE != "" ]] ; then - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$DESKTOP_NAME_FILE" "50")$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE" - elif [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] ; then - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$PORTPROTON_NAME" "50")$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$PORTPROTON_NAME" - elif (( ${#PORTPROTON_NAME_ABBR} > 2 )) && [[ ${PORTPROTON_NAME_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$PORTPROTON_NAME" "50")$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$PORTPROTON_NAME" - elif [[ ${FILE_DESCRIPTION^^} =~ ${PORTWINE_DB^^} ]] && [[ ${FILE_DESCRIPTION^^} != "${PORTWINE_DB^^}" ]] ; then - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$FILE_DESCRIPTION" "50")$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$FILE_DESCRIPTION" - elif (( ${#FILE_DESCRIPTION_ABBR} > 2 )) && [[ ${FILE_DESCRIPTION_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then - PW_COMMENT_DB="${translations[Launching]} $(print_wrapped "$FILE_DESCRIPTION" "50")$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$FILE_DESCRIPTION" - else - 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} > 3 )) ; 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")" - PW_SHORTCUT_PROXY="$PORTWINE_DB_NEW" - fi - else - PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")" - PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE" - fi + create_pw_comment export KEY_START="$RANDOM" if [[ "${PW_GUI_START}" == "NOTEBOOK" ]] ; then