From 5c6b863edfb06a244f0d22231e97a44fb09279da Mon Sep 17 00:00:00 2001 From: Htylol Date: Wed, 23 Oct 2024 13:07:48 +0500 Subject: [PATCH] Updates --- data_from_portwine/scripts/functions_helper | 23 +++++----------- data_from_portwine/scripts/start.sh | 30 +++++++++++++++------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 332fb88..41ec388 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -875,6 +875,7 @@ search_desktop_file () { # Конвертация секунд в дни, часы, минуты seconds_to_time () { + [[ ! $DESKTOP_WITH_TIME == enabled ]] && return 0 [[ -z $1 ]] && return 0 local seconds days hours minutes seconds=$1 @@ -5434,22 +5435,9 @@ portwine_create_shortcut () { [[ -z "${PW_SHORTCUT_DESKTOP}" ]] && PW_SHORTCUT_DESKTOP="TRUE" [[ -z "${PW_SHORTCUT_STEAM}" ]] && PW_SHORTCUT_STEAM="FALSE" - unset name_desktop - search_desktop_file - if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] ; then - for df in "${DESKTOP_FILES_ARRAY[@]}" ; do - df="${df//"$PORT_WINE_PATH/"/}" - df="${df//.desktop/}" - if [[ ${PORTWINE_DB^^} =~ ${df^^} ]] && [[ ${PORTWINE_DB^^} != ${df^^} ]] - then name_desktop="$df" - fi - done - fi - if [[ -z $name_desktop ]] ; then - if [[ -n $PW_SHORTCUT_PROXY ]] - then name_desktop="$PW_SHORTCUT_PROXY" - else name_desktop="$PORTWINE_DB" - fi + if [[ -n $PW_SHORTCUT_PROXY ]] + then name_desktop="$PW_SHORTCUT_PROXY" + else name_desktop="$PORTWINE_DB" fi export name_desktop @@ -5499,11 +5487,12 @@ portwine_create_shortcut () { edit_user_conf_from_gui PW_SHORTCUT_MENU PW_SHORTCUT_DESKTOP PW_SHORTCUT_STEAM - if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] && [[ $name_desktop != $df ]] || [[ -n ${DESKTOP_FILES_ARRAY[1]} ]] ; then + if [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] && [[ $name_desktop != $DESKTOP_NAME_FILE ]] || [[ -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" done + 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 ab24b1c..f081ccd 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -500,17 +500,30 @@ 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 - [[ $DESKTOP_WITH_TIME == enabled ]] && search_desktop_file + 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 - unset PW_SHORTCUT_PROXY - FILE_DESCRIPTION_ABBR=$(make_abbreviation "$FILE_DESCRIPTION") - PORTPROTON_NAME_ABBR=$(make_abbreviation "$PORTPROTON_NAME") - if [[ ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB^^} ]] && [[ ${PORTPROTON_NAME^^} != "${PORTWINE_DB^^}" ]] \ - || (( ${#PORTPROTON_NAME_ABBR} > 2 )) && [[ ${PORTPROTON_NAME_ABBR^^} =~ ${PORTWINE_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 [[ ${FILE_DESCRIPTION^^} =~ ${PORTWINE_DB^^} ]] && [[ ${FILE_DESCRIPTION^^} != "${PORTWINE_DB^^}" ]] \ - || (( ${#FILE_DESCRIPTION_ABBR} > 2 )) && [[ ${FILE_DESCRIPTION_ABBR^^} =~ ${PORTWINE_DB^^} ]] ; then + 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 @@ -549,6 +562,7 @@ if [[ -f "${portwine_exe}" ]] ; then fi else PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")" + PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE" fi export KEY_START="$RANDOM"