Commit 848fd8df authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'update-name_desktop_1' of github.com:Htylol/PortWINE into…

Merge branch 'update-name_desktop_1' of github.com:Htylol/PortWINE into Htylol-update-name_desktop_1
parents e4d82813 13d75e02
......@@ -273,7 +273,7 @@ EOF
while [[ ! $line =~ msgid ]] ; do
msgstr+=$line
read -r line
if [[ $line == "" ]] ; then
if [[ -z $line ]] ; then
break
fi
done
......@@ -762,8 +762,8 @@ background_pid () {
export bg_pid"${arg3}"="$PID" ;;
--end)
PID=$(get_bg_pid bg_pid"${arg3}")
[[ $PID == "" ]] && return 1
wait "$PID" && return 0 ;;
[[ -z $PID ]] && return 1
wait "$PID" 2>/dev/null && return 0 ;;
esac
fi
}
......@@ -911,70 +911,70 @@ search_desktop_file () {
fi
}
create_pw_comment () {
create_name_desktop () {
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
unset DESKTOP_NAME_FILE
if [[ -n $DESKTOP_NAME_YAD ]] ; then
DESKTOP_NAME_FILE="${DESKTOP_NAME_YAD//.desktop/}"
unset DESKTOP_NAME_YAD
elif [[ -n $name_desktop ]] ; then
DESKTOP_NAME_FILE="$name_desktop"
unset name_desktop
elif [[ -n ${DESKTOP_FILES_ARRAY[0]} ]] \
&& [[ -z ${DESKTOP_FILES_ARRAY[1]} ]] ; then
DESKTOP_NAME_FILE="${DESKTOP_FILES_ARRAY[0]//"$PORT_WINE_PATH/"/}"
DESKTOP_NAME_FILE="${DESKTOP_NAME_FILE//.desktop/}"
fi
[[ -n $PORTPROTON_NAME ]] && PORTPROTON_NAME_ABBR=$(make_abbreviation "$PORTPROTON_NAME")
[[ -n $FILE_DESCRIPTION ]] && FILE_DESCRIPTION_ABBR=$(make_abbreviation "$FILE_DESCRIPTION")
if [[ -z $PORTWINE_DB ]] ; then
PORTWINE_DB_DESKTOP="$(basename "${portwine_exe%.[Ee][Xx][Ee]}")"
else
PORTWINE_DB_DESKTOP="$PORTWINE_DB"
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]} <b>$(print_wrapped "$DESKTOP_NAME_FILE" "50")</b>$(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]} <b>$(print_wrapped "$PORTPROTON_NAME" "50")</b>$(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]} <b>$(print_wrapped "$PORTPROTON_NAME" "50")</b>$(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]} <b>$(print_wrapped "$FILE_DESCRIPTION" "50")</b>$(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]} <b>$(print_wrapped "$FILE_DESCRIPTION" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
PW_SHORTCUT_PROXY="$FILE_DESCRIPTION"
if [[ -n $DESKTOP_NAME_FILE ]] ; then
PW_NAME_DESKTOP_PROXY="$DESKTOP_NAME_FILE"
elif [[ -n $PORTPROTON_NAME && ${PORTPROTON_NAME^^} =~ ${PORTWINE_DB_DESKTOP^^} && $PORTPROTON_NAME != "$PORTWINE_DB_DESKTOP" ]] \
|| [[ -n $PORTPROTON_NAME && ${#PORTPROTON_NAME_ABBR} -gt 2 && ${PORTPROTON_NAME_ABBR^^} =~ ${PORTWINE_DB_DESKTOP^^} ]] ; then
PW_NAME_DESKTOP_PROXY="$PORTPROTON_NAME"
elif [[ -n $FILE_DESCRIPTION && ${FILE_DESCRIPTION^^} =~ ${PORTWINE_DB_DESKTOP^^} && $FILE_DESCRIPTION != "$PORTWINE_DB_DESKTOP" ]] \
|| [[ -n $FILE_DESCRIPTION && ${#FILE_DESCRIPTION_ABBR} -gt 2 && ${FILE_DESCRIPTION_ABBR^^} =~ ${PORTWINE_DB_DESKTOP^^} ]] ; then
PW_NAME_DESKTOP_PROXY="$FILE_DESCRIPTION"
else
unset PORTWINE_DB_PROXY PORTWINE_DB_NEW
PORTWINE_DB_DESKTOP="${PORTWINE_DB_DESKTOP//_/ }"
if [[ ${PORTWINE_DB_DESKTOP:0:1} =~ [a-z] ]] ; then
PORTWINE_DB_UPPER="${PORTWINE_DB_DESKTOP^^}"
PORTWINE_DB_DESKTOP="${PORTWINE_DB_UPPER:0:1}${PORTWINE_DB_DESKTOP:1}"
fi
if (( ${#PORTWINE_DB_DESKTOP} > 3 )) ; then
for ((i=0 ; i<${#PORTWINE_DB_DESKTOP} ; i++)) ; do
if [[ ${PORTWINE_DB_DESKTOP:i:2} =~ ([a-z][A-Z]|[a-z][0-9]) ]] \
&& [[ ! ${PORTWINE_DB_DESKTOP:i:3} =~ ([a-z][A-Z]" "|[a-z][0-9]" ") ]] ; then
PORTWINE_DB_PROXY+="${PORTWINE_DB_DESKTOP:i:1} "
elif [[ ${PORTWINE_DB_DESKTOP:i:3} =~ [0-9][0-9][a-zA-Z] ]] ; then
PORTWINE_DB_PROXY+="${PORTWINE_DB_DESKTOP:i:2} "
((i++))
else
PORTWINE_DB_PROXY+="${PORTWINE_DB_DESKTOP: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
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]} <b>$(print_wrapped "$PORTWINE_DB_NEW" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
PW_SHORTCUT_PROXY="$PORTWINE_DB_NEW"
PORTWINE_DB_NEW="$PORTWINE_DB_DESKTOP"
fi
else
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")"
PW_SHORTCUT_PROXY="$DESKTOP_NAME_FILE"
PW_NAME_DESKTOP_PROXY="$PORTWINE_DB_NEW"
fi
}
......@@ -1021,10 +1021,10 @@ seconds_to_time () {
if [[ $minutes =~ ^0$ ]] ; then
hours=${hours//" ${translations[and]} "/}
minutes=
if [[ $days == "" ]] || [[ $hours == "" ]] ; then
if [[ -z $days ]] || [[ -z $hours ]] ; then
days=${days//","/}
fi
if [[ $days == "" ]] && [[ $hours == "" ]] ; then
if [[ -z $days ]] && [[ -z $hours ]] ; then
minutes="${translations[less than a minute]}"
fi
elif [[ $minutes =~ ^1$ ]] ; then
......@@ -2510,8 +2510,7 @@ pw_find_exe () {
if [[ -n "${PW_SET_FIND_EXE}" ]] ; then
portwine_exe="${PW_PATH_FOR_FIND}$(echo "${PW_SET_FIND_EXE}" | awk -F'|' '{print $1}')"
portwine_create_shortcut silent
restart_pp
portwine_create_shortcut
fi
}
......@@ -4592,7 +4591,7 @@ relaxed - Same as fifo but allows tearing when below the monitors refresh rate.]
1> "$PW_TMPFS_PATH/tmp_output_yad_fps_limit" 2>/dev/null &
"${pw_yad}" --notebook --key="$KEY_EDIT_DB_GUI" --title "${translations[EDIT DB]}" --text-align=center \
--text "${translations[Change settings in database file for]} <b>${PORTWINE_DB}</b>\n ${translations[<b>NOTE:</b> To display help for each item, simply hover your mouse over the text]}" \
--text "${translations[Change settings in database file for]} <b>$PW_NAME_DESKTOP_PROXY</b>\n ${translations[<b>NOTE:</b> To display help for each item, simply hover your mouse over the text]}" \
--window-icon="$PW_GUI_ICON_PATH/portproton.svg" --separator=" " --expand \
--gui-type="settings-base" \
--gui-type-text="${NOTEBOOK_GUI_TYPE_TEXT}" --gui-type-layout="${NOTEBOOK_GUI_TYPE_LAYOUT}" \
......@@ -5233,7 +5232,7 @@ gui_gamescope () {
unset ADD_CHK_BOX_GS
if [[ "${GAMESCOPE_INSTALLED}" == 1 ]] ; then
GAMESCOPE_NEED_INSTALL="${translations[Change settings gamescope for]} <b>${PORTWINE_DB}</b>\n ${translations[<b>NOTE:</b> To display help for each item, simply hover your mouse over the text]}"
GAMESCOPE_NEED_INSTALL="${translations[Change settings gamescope for]} <b>$PW_NAME_DESKTOP_PROXY</b>\n ${translations[<b>NOTE:</b> To display help for each item, simply hover your mouse over the text]}"
GS_CB="CB" && GS_CBE="CBE" && GS_NUM="NUM" && GS_NUMN="NUMN"
for int_to_boole in ${PW_GS_LIST[@]} ; do
if [[ "${!int_to_boole}" == "1" ]]
......@@ -5540,8 +5539,9 @@ portwine_create_shortcut () {
[[ -z "${PW_SHORTCUT_DESKTOP}" ]] && PW_SHORTCUT_DESKTOP="TRUE"
[[ -z "${PW_SHORTCUT_STEAM}" ]] && PW_SHORTCUT_STEAM="FALSE"
[[ -z $PW_SHORTCUT_PROXY ]] && create_pw_comment
export name_desktop="$PW_SHORTCUT_PROXY"
unset name_desktop
create_name_desktop
export name_desktop="$PW_NAME_DESKTOP_PROXY"
[[ -z "${name_desktop_png}" ]] && name_desktop_png="${PORTPROTON_NAME// /_}"
......@@ -5594,12 +5594,13 @@ portwine_create_shortcut () {
for rm in "${DESKTOP_FILES_ARRAY[@]}" ; do
rm -f "$rm"
done
[[ $name_desktop == "" ]] && create_pw_comment && export name_desktop="$PW_SHORTCUT_PROXY"
fi
else
try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop"
fi
[[ -z $name_desktop ]] && create_name_desktop && export name_desktop="$PW_NAME_DESKTOP_PROXY"
echo "[Desktop Entry]" > "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Name=${name_desktop}" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
if check_flatpak
......@@ -6185,6 +6186,7 @@ button_click () {
(( count++ ))
done
fi
export DESKTOP_NAME_YAD="${PW_YAD_SET//"$PORT_WINE_PATH/"/}"
if check_flatpak
then PW_EXEC_FROM_DESKTOP="$(grep Exec "$PW_YAD_SET" | head -n 1 | sed 's|flatpak run ru.linux_gaming.PortProton|\"${PORT_SCRIPTS_PATH}/start.sh\"|' | awk -F'=' '{print $2}')"
else PW_EXEC_FROM_DESKTOP="$(grep Exec "$PW_YAD_SET" | head -n 1 | awk -F"=env " '{print $2}')"
......
......@@ -497,7 +497,12 @@ 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
create_pw_comment
create_name_desktop
if [[ -z "${PW_COMMENT_DB}" ]] ; then
PW_COMMENT_DB="${translations[Launching]} <b>$(print_wrapped "$PW_NAME_DESKTOP_PROXY" "50")</b>$(seconds_to_time "$TIME_CURRENT")"
else
PW_COMMENT_DB="$PW_COMMENT_DB$(seconds_to_time "$TIME_CURRENT")"
fi
export KEY_START="$RANDOM"
if [[ "${PW_GUI_START}" == "NOTEBOOK" ]] ; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment