diff --git a/data_from_portwine/locales/PortProton.pot b/data_from_portwine/locales/PortProton.pot index 9432324..466e591 100644 --- a/data_from_portwine/locales/PortProton.pot +++ b/data_from_portwine/locales/PortProton.pot @@ -7,13 +7,13 @@ msgid "" msgstr "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" - "POT-Creation-Date: 2025-03-02 01:22+0500\n" + "POT-Creation-Date: 2025-03-06 03:47+0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" - "Content-Type: text/plain; charset=UTF-8\n" + "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" msgid "A running PortProton session was detected.\\nDo you want to end the " @@ -1293,12 +1293,6 @@ msgstr "" msgid "Change settings gamescope for" msgstr "" -msgid "Gamescope is not detected on the system, to install it, run the " - "command in the terminal:\\nflatpak install -y runtime/org." - "freedesktop.Platform.VulkanLayer.gamescope/x86_64/$" - "%{GAMESCOPE_VERSION}%\\n(Can be selected and copied)" -msgstr "" - msgid "Gamescope is not detected on the system, please contact the " "manufacturer of your distribution\\nor search the Internet for " "information on how to install gamescope on your system." @@ -1421,6 +1415,12 @@ msgstr "" msgid "Show in days, hours, minutes" msgstr "" +msgid "According to last launch" +msgstr "" + +msgid "By time" +msgstr "" + msgid "Recommended value" msgstr "" @@ -1476,11 +1476,10 @@ msgstr "" msgid "Displays time spent in an application or game" msgstr "" -msgid "Sort shortcuts by time" +msgid "Sort shortcuts by" msgstr "" -msgid "This setting sorts the shortcuts in the main menu depending on the " - "time spent in the application or game" +msgid "This setting sorts the shortcuts in the main menu" msgstr "" msgid "GLOBAL SETTINGS (USER.CONF)" @@ -1628,14 +1627,6 @@ msgstr "" msgid "SAVE" msgstr "" -#, sh-format -msgid "PortProton v. ${install_ver}\n" - "scripts v. ${scripts_install_ver}" -msgstr "" - -msgid "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" -msgstr "" - msgid "This program comes with absolutely no warranty.\n" "See the License for details." msgstr "" diff --git a/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po b/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po index 17dc96c..5fc474f 100644 --- a/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po +++ b/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-02 01:22+0500\n" +"POT-Creation-Date: 2025-03-05 23:40+0500\n" "PO-Revision-Date: 2024-11-13 08:18+0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -1679,17 +1679,6 @@ msgstr "" msgid "Change settings gamescope for" msgstr "Cambiar ajustes gamescope para" -msgid "" -"Gamescope is not detected on the system, to install it, run the command " -"in the terminal:\\nflatpak install -y runtime/org.freedesktop.Platform." -"VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Can be selected and " -"copied)" -msgstr "" -"Gamescope no se detecta en el sistema, para instalarlo, ejecute el " -"comando en el terminal:\\n flatpak install -y runtime/org.freedesktop." -"Platform.VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n (Se puede " -"seleccionar y copiar)" - msgid "" "Gamescope is not detected on the system, please contact the manufacturer " "of your distribution\\nor search the Internet for information on how to " @@ -1850,6 +1839,13 @@ msgstr "" msgid "Show in days, hours, minutes" msgstr "" +msgid "According to last launch" +msgstr "" + +#, fuzzy +msgid "By time" +msgstr "Mostrar tiempo" + msgid "Recommended value" msgstr "" @@ -1908,12 +1904,12 @@ msgstr "Mostrar tiempo" msgid "Displays time spent in an application or game" msgstr "Muestra el tiempo transcurrido en una aplicación o juego" -msgid "Sort shortcuts by time" +#, fuzzy +msgid "Sort shortcuts by" msgstr "Ordenar accesos directos por tiempo" -msgid "" -"This setting sorts the shortcuts in the main menu depending on the time " -"spent in the application or game" +#, fuzzy +msgid "This setting sorts the shortcuts in the main menu" msgstr "" "Esta configuración ordena los accesos directos en el menú principal según el " "tiempo transcurrido en la aplicación o juego" @@ -2079,17 +2075,6 @@ msgstr "ATRÁS" msgid "SAVE" msgstr "AHORRAR" -#, sh-format -msgid "" -"PortProton v. ${install_ver}\n" -"scripts v. ${scripts_install_ver}" -msgstr "" -"PortProton v. ${install_ver}\n" -"scripts v. ${scripts_install_ver}" - -msgid "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" -msgstr "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" - msgid "" "This program comes with absolutely no warranty.\n" "See the License for details." @@ -2194,6 +2179,28 @@ msgstr "Restarting STEAM... Please wait." msgid "Please wait. downloading covers for" msgstr "Por favor, espera. Descargando portadas para" +#~ msgid "" +#~ "Gamescope is not detected on the system, to install it, run the " +#~ "command in the terminal:\\nflatpak install -y runtime/org.freedesktop." +#~ "Platform.VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Can be " +#~ "selected and copied)" +#~ msgstr "" +#~ "Gamescope no se detecta en el sistema, para instalarlo, ejecute el " +#~ "comando en el terminal:\\n flatpak install -y runtime/org.freedesktop." +#~ "Platform.VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n (Se puede " +#~ "seleccionar y copiar)" + +#, sh-format +#~ msgid "" +#~ "PortProton v. ${install_ver}\n" +#~ "scripts v. ${scripts_install_ver}" +#~ msgstr "" +#~ "PortProton v. ${install_ver}\n" +#~ "scripts v. ${scripts_install_ver}" + +#~ msgid "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" +#~ msgstr "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" + #~ msgid "Change the version of WINDOWS 10 to WINDOWS 7 in the prefix" #~ msgstr "Cambiar la versión de Windows 10 a Windows 7 en el prefijo" diff --git a/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po b/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po index 6c26004..b582f60 100644 --- a/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po +++ b/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-02 01:22+0500\n" -"PO-Revision-Date: 2025-03-02 01:22+0500\n" +"POT-Creation-Date: 2025-03-05 23:40+0500\n" +"PO-Revision-Date: 2025-03-06 03:43+0500\n" "Last-Translator: \n" "Language-Team: \n" "Language: ru_RU\n" @@ -1668,17 +1668,6 @@ msgstr "" msgid "Change settings gamescope for" msgstr "Изменить настройки Gamescope для" -msgid "" -"Gamescope is not detected on the system, to install it, run the command " -"in the terminal:\\nflatpak install -y runtime/org.freedesktop.Platform." -"VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Can be selected and " -"copied)" -msgstr "" -"Gamescope не найден в системе, для его установки выполните команду в " -"терминале:\\nflatpak install -y runtime/org.freedesktop.Platform.VulkanLayer." -"gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Данный текст можно выделить и " -"скопировать)" - msgid "" "Gamescope is not detected on the system, please contact the manufacturer " "of your distribution\\nor search the Internet for information on how to " @@ -1838,6 +1827,12 @@ msgstr "Отображать в часах и минутах" msgid "Show in days, hours, minutes" msgstr "Отображать в днях, часах и минутах" +msgid "According to last launch" +msgstr "По данным последнего запуска" + +msgid "By time" +msgstr "По проведённому времени" + msgid "Recommended value" msgstr "Рекомендуемое значение" @@ -1896,15 +1891,11 @@ msgstr "Отображение времени" msgid "Displays time spent in an application or game" msgstr "Отображает общее время проведённое в приложении или игре" -msgid "Sort shortcuts by time" -msgstr "Сортировка ярлыков по времени" +msgid "Sort shortcuts by" +msgstr "Сортировка ярлыков по" -msgid "" -"This setting sorts the shortcuts in the main menu depending on the time " -"spent in the application or game" -msgstr "" -"Эта настройка сортирует ярлыки в главном меню в зависимости от времени, " -"проведенного в приложении или игре" +msgid "This setting sorts the shortcuts in the main menu" +msgstr "Эта настройка сортирует ярлыки в главном меню" msgid "GLOBAL SETTINGS (USER.CONF)" msgstr "ГЛОБАЛЬНЫЕ НАСТРОЙКИ (USER.CONF)" @@ -2066,17 +2057,6 @@ msgstr "НАЗАД" msgid "SAVE" msgstr "СОХРАНИТЬ" -#, sh-format -msgid "" -"PortProton v. ${install_ver}\n" -"scripts v. ${scripts_install_ver}" -msgstr "" -"PortProton v. ${install_ver}\n" -"версия v. ${scripts_install_ver}" - -msgid "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" -msgstr "Авторские права © $%DATE% Castro-Fidel (linux-gaming.ru)" - msgid "" "This program comes with absolutely no warranty.\n" "See the License for details." @@ -2181,6 +2161,28 @@ msgstr "Перезапускаем STEAM... Пожалуйста, подожди msgid "Please wait. downloading covers for" msgstr "Пожалуйста, подождите. Загрузка обложек для" +#~ msgid "" +#~ "Gamescope is not detected on the system, to install it, run the " +#~ "command in the terminal:\\nflatpak install -y runtime/org.freedesktop." +#~ "Platform.VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Can be " +#~ "selected and copied)" +#~ msgstr "" +#~ "Gamescope не найден в системе, для его установки выполните команду в " +#~ "терминале:\\nflatpak install -y runtime/org.freedesktop.Platform." +#~ "VulkanLayer.gamescope/x86_64/$%{GAMESCOPE_VERSION}%\\n(Данный текст можно " +#~ "выделить и скопировать)" + +#, sh-format +#~ msgid "" +#~ "PortProton v. ${install_ver}\n" +#~ "scripts v. ${scripts_install_ver}" +#~ msgstr "" +#~ "PortProton v. ${install_ver}\n" +#~ "версия v. ${scripts_install_ver}" + +#~ msgid "Copyright © $%DATE% Castro-Fidel (linux-gaming.ru)" +#~ msgstr "Авторские права © $%DATE% Castro-Fidel (linux-gaming.ru)" + #~ msgid "WineD3D Vulkan (Damavand experimental)" #~ msgstr "WineD3D Vulkan (Damavand - экспериментальный)" diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index d0556d4..d2c741d 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -1010,144 +1010,139 @@ search_desktop_file () { fi fi done - if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then - while read -r -a line2 ; do - if [[ -z ${line2[0]} ]] \ - || [[ ! ${line2[0],,} =~ .(bat|exe|msi|reg)$ ]] ; then - BROKEN_LINE=1 - break + + while read -r -a line2 ; do + if [[ -z ${line2[0]} ]] \ + || [[ ! ${line2[0],,} =~ .(bat|exe|msi|reg)$ ]] ; then + BROKEN_LINE=1 + break + fi + if [[ ${line2[1]} == "$FILE_SHA256SUM" ]] ; then + FILE_SHA256SUM_FOUND=1 + break + fi + if [[ ${line2[1]} != "$FILE_SHA256SUM" ]] \ + && [[ ${line2[0]} == "${portwine_exe// /#@_@#}" ]] ; then + FILE_SHA256SUM_NOT_FOUND=1 + break + fi + done < "$PORT_WINE_TMP_PATH/statistics" + + local line3 line4 count_line i TIME_TOTAL SKIP_REPAIR + ## Ремонты: + # Ремонт, проверяет чтобы длинна хеш суммы была равна 64 символам, в ином случае удалит битые + if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] && [[ ${#line2[1]} != "64" ]] ; then + while read -r -a line3 ; do + if [[ ${#line3[1]} == "64" ]] + then echo "${line3[*]}" fi - if [[ ${line2[1]} == "$FILE_SHA256SUM" ]] ; then - FILE_SHA256SUM_FOUND=1 - break - fi - if [[ ${line2[1]} != "$FILE_SHA256SUM" ]] \ - && [[ ${line2[0]} == "${portwine_exe// /#@_@#}" ]] ; then - FILE_SHA256SUM_NOT_FOUND=1 - break - fi - done < "$PORT_WINE_TMP_PATH/statistics" + done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" + try_remove_file "$PORT_WINE_TMP_PATH/statistics" + mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" + return 1 fi - if [[ $DESKTOP_WITH_TIME == enabled ]] || [[ $SORT_WITH_TIME == enabled ]] ; then - local line3 line4 count_line i TIME_TOTAL SKIP_REPAIR - ## Ремонты: - # Ремонт, проверяет чтобы длинна хеш суммы была равна 64 символам, в ином случае удалит битые - if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] && [[ ${#line2[1]} != "64" ]] ; then - while read -r -a line3 ; do - if [[ ${#line3[1]} == "64" ]] - then echo "${line3[*]}" - fi - done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" - try_remove_file "$PORT_WINE_TMP_PATH/statistics" - mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" - return 1 - fi - # Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg - if [[ $BROKEN_LINE == 1 ]] ; then - while read -r -a line4 ; do - if [[ -n ${line4[0]} ]] && [[ ${line4[0],,} =~ .(bat|exe|msi|reg)$ ]] - then echo "${line4[*]}" - fi - done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" - try_remove_file "$PORT_WINE_TMP_PATH/statistics" - mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" - return 1 - fi - - # Ремонтирует путь на новый, если вдруг путь до .exe файла битый или изменился, но .exe файл он опознал - if [[ $FILE_SHA256SUM_FOUND == 1 ]] && [[ ${line2[0]} != "${portwine_exe// /#@_@#}" ]] ; then - sed -i "s|${line2[0]} ${line2[1]}|${portwine_exe// /#@_@#} ${line2[1]}|" "$PORT_WINE_TMP_PATH/statistics" - line2[0]=${portwine_exe// /#@_@#} - fi - - # Ремонт, если sha256sum изменилась, но путь до .exe тот же - if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] ; then - sed -i "s|${line2[0]} ${line2[1]}|${line2[0]} $FILE_SHA256SUM|" "$PORT_WINE_TMP_PATH/statistics" - line2[1]=$FILE_SHA256SUM - fi - - # Когда приложения ещё нет в статистике - [[ -z ${line2[2]} ]] && line2[2]=0 - # Ремонт, если сломалось время - if (( line2[2] >= 999999999 )) ; then - sed -i "s|${line2[1]} ${line2[2]}|${line2[1]} 0|" "$PORT_WINE_TMP_PATH/statistics" - line2[2]=0 - fi - # Ремонт, если кто-то сломал время - if [[ ! ${line2[2]} =~ ^[0-9]+$ ]] ; then - sed -i "/${line2[1]}/d" "$PORT_WINE_TMP_PATH/statistics" - return 1 - fi - - ############################### - # Общее проведённое время в секундах - export TIME_CURRENT=${line2[2]} - # количество запусков приложения - export COUNT_STARTS=${line2[4]//L4-/} - ############################### - - # Проверка новых десктоп файлов, чтобы их можно было сортировать первыми при первом создании в главном меню + ремонт - if [[ $PW_NEW_DESKTOP == 1 ]] && [[ ${line2[3]} != NEW_DESKTOP ]] ; then - if [[ $FILE_SHA256SUM_FOUND == 1 ]] ; then - sed -i "s|${line2[1]} \(.*\) ${line2[3]}|${line2[1]} \1 NEW_DESKTOP|" "$PORT_WINE_TMP_PATH/statistics" - else - echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_CURRENT NEW_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics" + # Ремонт, если есть пустые строки и непонятные строки без .exe, .bat, .msi, .reg + if [[ $BROKEN_LINE == 1 ]] ; then + while read -r -a line4 ; do + if [[ -n ${line4[0]} ]] && [[ ${line4[0],,} =~ .(bat|exe|msi|reg)$ ]] + then echo "${line4[*]}" fi - fi - unset PW_NEW_DESKTOP + done < "$PORT_WINE_TMP_PATH/statistics" > "$PORT_WINE_TMP_PATH/statistics_repair" + try_remove_file "$PORT_WINE_TMP_PATH/statistics" + mv -f "$PORT_WINE_TMP_PATH/statistics_repair" "$PORT_WINE_TMP_PATH/statistics" + return 1 + fi - # Когда приложение было запущено и завершено - if [[ -n $PW_TIME_IN_GAME ]] ; then - TIME_TOTAL=$(( TIME_CURRENT + PW_TIME_IN_GAME )) - if [[ $FILE_SHA256SUM_FOUND == 1 ]] ; then - # Когда есть предыдущее время - sed -i "s|$FILE_SHA256SUM $TIME_CURRENT|$FILE_SHA256SUM $TIME_TOTAL|" "$PORT_WINE_TMP_PATH/statistics" + # Ремонтирует путь на новый, если вдруг путь до .exe файла битый или изменился, но .exe файл он опознал + if [[ $FILE_SHA256SUM_FOUND == 1 ]] && [[ ${line2[0]} != "${portwine_exe// /#@_@#}" ]] ; then + sed -i "s|${line2[0]} ${line2[1]}|${portwine_exe// /#@_@#} ${line2[1]}|" "$PORT_WINE_TMP_PATH/statistics" + line2[0]=${portwine_exe// /#@_@#} + fi + + # Ремонт, если sha256sum изменилась, но путь до .exe тот же + if [[ $FILE_SHA256SUM_NOT_FOUND == 1 ]] ; then + sed -i "s|${line2[0]} ${line2[1]}|${line2[0]} $FILE_SHA256SUM|" "$PORT_WINE_TMP_PATH/statistics" + line2[1]=$FILE_SHA256SUM + fi + + # Когда приложения ещё нет в статистике + [[ -z ${line2[2]} ]] && line2[2]=0 + # Ремонт, если сломалось время + if (( line2[2] >= 999999999 )) ; then + sed -i "s|${line2[1]} ${line2[2]}|${line2[1]} 0|" "$PORT_WINE_TMP_PATH/statistics" + line2[2]=0 + fi + # Ремонт, если кто-то сломал время + if [[ ! ${line2[2]} =~ ^[0-9]+$ ]] ; then + sed -i "/${line2[1]}/d" "$PORT_WINE_TMP_PATH/statistics" + return 1 + fi + + ############################### + # Общее проведённое время в секундах + export TIME_CURRENT=${line2[2]} + # количество запусков приложения + export COUNT_STARTS=${line2[4]//L4-/} + ############################### + + # Проверка новых десктоп файлов, чтобы их можно было сортировать первыми при первом создании в главном меню + ремонт + if [[ $PW_NEW_DESKTOP == 1 ]] && [[ ${line2[3]} != NEW_DESKTOP ]] ; then + if [[ $FILE_SHA256SUM_FOUND == 1 ]] ; then + sed -i "s|${line2[1]} \(.*\) ${line2[3]}|${line2[1]} \1 NEW_DESKTOP|" "$PORT_WINE_TMP_PATH/statistics" + else + echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_CURRENT NEW_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics" + fi + fi + unset PW_NEW_DESKTOP + + # Когда приложение было запущено и завершено + if [[ -n $PW_TIME_IN_GAME ]] ; then + TIME_TOTAL=$(( TIME_CURRENT + PW_TIME_IN_GAME )) + if [[ $FILE_SHA256SUM_FOUND == 1 ]] ; then + # Когда есть предыдущее время + sed -i "s|$FILE_SHA256SUM $TIME_CURRENT|$FILE_SHA256SUM $TIME_TOTAL|" "$PORT_WINE_TMP_PATH/statistics" + else + # Когда только запустили приложение первый раз + echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_TOTAL OLD_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics" + fi + # Для ремонта если вдруг в линии ещё что-то есть + count_line=6 + # Здесь добавляются новые линии для статистики (L4-) важен + if [[ -z ${line2[4]} ]] ; then + SKIP_REPAIR=1 + sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics" + else + # ремонт, если L4 по каким-то причинам сломался + if [[ ${line2[4]} =~ ^L4 ]] ; then + local NUMBER_OF_STARTS=$(( ${line2[4]//L4-/} + 1 )) else - # Когда только запустили приложение первый раз - echo "${portwine_exe// /#@_@#} $FILE_SHA256SUM $TIME_TOTAL OLD_DESKTOP" >> "$PORT_WINE_TMP_PATH/statistics" - fi - count_line=4 - # Здесь добавляются новые линии для статистики (L4-) важен - if [[ -z ${line2[4]} ]] ; then SKIP_REPAIR=1 - sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics" - else - # ремонт, если L4 по каким-то причинам сломался - if [[ ${line2[4]} =~ ^L4 ]] ; then - local NUMBER_OF_STARTS=$(( ${line2[4]//L4-/} + 1 )) - else - SKIP_REPAIR=1 - sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[4]}|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics" - fi + sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[4]}|$FILE_SHA256SUM \1 L4-1|" "$PORT_WINE_TMP_PATH/statistics" fi - (( count_line ++ )) + fi -# Пример для L5 -# if [[ -z ${line2[5]} ]] ; then -# SKIP_REPAIR=1 -# sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L5-1|" "$PORT_WINE_TMP_PATH/statistics" -# else -# if [[ ${line2[5]} =~ ^L5 ]] ; then -# local ЗДЕСЬ_НОВАЯ_ПЕРЕМЕННАЯ=$(( ${line2[5]//L5-/} + 1 )) -# else -# SKIP_REPAIR=1 -# sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[5]}|$FILE_SHA256SUM \1 L5-1|" "$PORT_WINE_TMP_PATH/statistics" -# fi -# fi -# (( count_line ++ )) + if [[ $SKIP_REPAIR != 1 ]] ; then + # Ремонт, если количество элементов массива по каким-то причина больше, чем должно быть + if [[ -n ${line2["$count_line"]} ]] ; then + for i in $(seq $count_line ${#line2[@]}) ; do + unset 'line2[$i]' + done + sed -i "s|${portwine_exe// /#@_@#} $FILE_SHA256SUM \(.*\)|${line2[*]}|" "$PORT_WINE_TMP_PATH/statistics" + fi + # Для правильной работы L4 + sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[4]}|$FILE_SHA256SUM \1 L4-$NUMBER_OF_STARTS|" "$PORT_WINE_TMP_PATH/statistics" + fi - if [[ $SKIP_REPAIR != 1 ]] ; then - # Ремонт, если количество элементов массива по каким-то причина больше, чем должно быть - if [[ -n ${line2["$count_line"]} ]] ; then - for i in $(seq $count_line ${#line2[@]}) ; do - unset 'line2[$i]' - done - sed -i "s|${portwine_exe// /#@_@#} $FILE_SHA256SUM \(.*\)|${line2[*]}|" "$PORT_WINE_TMP_PATH/statistics" - fi - # Сюда все sedы от L4, L5 и т.д. (после всех ремонтов) - sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[4]}|$FILE_SHA256SUM \1 L4-$NUMBER_OF_STARTS|" "$PORT_WINE_TMP_PATH/statistics" -# sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[5]}|$FILE_SHA256SUM \1 L5-$NUMBER_OF_STARTS|" "$PORT_WINE_TMP_PATH/statistics" + # Для правильной работы статистики по последнему запуску + if [[ $SORT_WITH_TIME == "lastlaunch" ]] ; then + LAST_LAUNCH=$(grep -o 'L5-[0-9]\+' "$PORT_WINE_TMP_PATH/statistics" | sed 's/L5-//' | sort -nr | head -1) + [[ -z $LAST_LAUNCH ]] && LAST_LAUNCH=0 + LAST_LAUNCH=$(( LAST_LAUNCH + 1 )) + if [[ -z ${line2[5]} ]] ; then + sed -i "s|$FILE_SHA256SUM \(.*\)|$FILE_SHA256SUM \1 L5-$LAST_LAUNCH|" "$PORT_WINE_TMP_PATH/statistics" + else + sed -i "s|$FILE_SHA256SUM \(.*\) ${line2[5]}|$FILE_SHA256SUM \1 L5-$LAST_LAUNCH|" "$PORT_WINE_TMP_PATH/statistics" fi fi fi @@ -6032,12 +6027,12 @@ gui_userconf () { DESKTOP_WITH_TIME="disabled" fi - if [[ -n "$SORT_WITH_TIME" ]] \ - && [[ "$SORT_WITH_TIME" == "disabled" ]] - then - SORT_WITH_TIME="disabled" + if [[ $SORT_WITH_TIME == "lastlaunch" ]] ; then + SORT_WITH_TIME=${translations[According to last launch]} + elif [[ $SORT_WITH_TIME == "bytime" ]] ; then + SORT_WITH_TIME=${translations[By time]} else - SORT_WITH_TIME="enabled" + SORT_WITH_TIME="disabled" fi if [[ $PW_WINE_DPI_VALUE == "recommended" ]] ; then @@ -6074,7 +6069,7 @@ gui_userconf () { --field="${translations[Select PortProton theme]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "${translations[default]}!${translations[compact]}!${translations[classic]}")" \ --field="${translations[Select gtk theme]}!${translations[Allows you to select a theme for GTK.]} :CB" "$(combobox_fix "$GTK_THEME" "${YAD_GTK_THEME}Adwaita:${translations[light]}!Adwaita:${translations[dark]}!${translations[default]}")" \ --field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "${translations[Show in hours and minutes]}!${translations[Show in days, hours, minutes]}")" \ - --field="${translations[Sort shortcuts by time]}!${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" "$(combobox_fix --disabled "$SORT_WITH_TIME" "enabled")" \ + --field="${translations[Sort shortcuts by]}!${translations[This setting sorts the shortcuts in the main menu]} :CB" "$(combobox_fix --disabled "$SORT_WITH_TIME" "${translations[According to last launch]}!${translations[By time]}")" \ 1> "${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb" 2>/dev/null & "${pw_yad}" --key=$KEY_USERCONF_GUI --paned --sensitive \ @@ -6128,6 +6123,9 @@ gui_userconf () { if [[ $DESKTOP_WITH_TIME == "${translations[Show in hours and minutes]}" ]] ; then DESKTOP_WITH_TIME="posnumber1" elif [[ $DESKTOP_WITH_TIME == "${translations[Show in days, hours, minutes]}" ]] ; then DESKTOP_WITH_TIME="posnumber2" fi + if [[ $SORT_WITH_TIME == "${translations[According to last launch]}" ]] ; then SORT_WITH_TIME="lastlaunch" + elif [[ $SORT_WITH_TIME == "${translations[By time]}" ]] ; then SORT_WITH_TIME="bytime" + fi edit_user_conf_from_gui PW_GPU_USE PW_WINE_DPI_VALUE PW_SOUND_DRIVER_USE GUI_THEME GTK_THEME DESKTOP_WITH_TIME SORT_WITH_TIME restart_pp diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index 1516bec..d0a34cb 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -270,11 +270,21 @@ if [[ -z $DESKTOP_WITH_TIME ]] ; then export DESKTOP_WITH_TIME="posnumber1" fi -# TODO:fixes_after_update +# SORT_WITH_TIME by default sorts from the last run +if [[ -z $SORT_WITH_TIME ]] ; then + echo 'export SORT_WITH_TIME="lastlaunch"' >> "$USER_CONF" + export SORT_WITH_TIME="lastlaunch" +fi + +# TODO:fixes_after_update (со временем можно будет дропнуть) if fixes_after_update "2395: DESKTOP_WITH_TIME by default displays hours and minutes" ; then DESKTOP_WITH_TIME="posnumber1" edit_user_conf_from_gui DESKTOP_WITH_TIME fi +if fixes_after_update "2398: SORT_WITH_TIME by default sorts from the last run" ; then + SORT_WITH_TIME="lastlaunch" + edit_user_conf_from_gui SORT_WITH_TIME +fi # choose wine dpi default if [[ -z $PW_WINE_DPI_VALUE ]] ; then @@ -645,7 +655,7 @@ else fi unset PW_NAME_D_ICON PW_ICON_PATH PW_GAME_TIME PW_ALL_DF PW_AMOUNT_NEW_DESKTOP - unset PW_DESKTOP_FILES_REGEX PW_AMOUNT_OLD_DESKTOP PW_DESKTOP_FILES + unset PW_DESKTOP_FILES_REGEX PW_AMOUNT_OLD_DESKTOP PW_DESKTOP_FILES PW_LAST_LAUNCH # Поиск .desktop файлов AMOUNT_GENERATE_BUTTONS="0" for desktop_file in "$PORT_WINE_PATH"/* ; do @@ -679,13 +689,17 @@ else fi while read -r -a line2 ; do if [[ \"${line2[0]//#@_@#/ }\" == "${PW_NAME_D_ICON["$AMOUNT_GENERATE_BUTTONS"]}" ]] ; then - PW_GAME_TIME["$AMOUNT_GENERATE_BUTTONS"]=${line2[2]} + [[ $SORT_WITH_TIME == "bytime" ]] && PW_GAME_TIME["$AMOUNT_GENERATE_BUTTONS"]=${line2[2]} + if [[ $SORT_WITH_TIME == "lastlaunch" ]] ; then + [[ -n ${line2[5]} ]] && PW_LAST_LAUNCH["$AMOUNT_GENERATE_BUTTONS"]=${line2[5]//L5-/} + fi break else - PW_GAME_TIME["$AMOUNT_GENERATE_BUTTONS"]=0 + [[ $SORT_WITH_TIME == "bytime" ]] && PW_GAME_TIME["$AMOUNT_GENERATE_BUTTONS"]=0 + [[ $SORT_WITH_TIME == "lastlaunch" ]] && PW_LAST_LAUNCH["$AMOUNT_GENERATE_BUTTONS"]=0 fi done < "$PORT_WINE_TMP_PATH/statistics" - if [[ $SORT_WITH_TIME == enabled ]] && [[ ${line2[3]} == NEW_DESKTOP ]] ; then + if [[ $SORT_WITH_TIME != "disabled" ]] && [[ ${line2[3]} == "NEW_DESKTOP" ]] ; then sed -i "s/${line2[1]} ${line2[2]} NEW_DESKTOP/${line2[1]} ${line2[2]} OLD_DESKTOP/" "$PORT_WINE_TMP_PATH/statistics" PW_AMOUNT_NEW_DESKTOP+=("$AMOUNT_GENERATE_BUTTONS") else @@ -696,7 +710,7 @@ else fi done # Переопределение элементов в массивах в зависимости от PW_GAME_TIME, от большего значения к меньшему. - if [[ $SORT_WITH_TIME == enabled ]] && [[ -n ${PW_GAME_TIME[1]} ]] ; then + if [[ $SORT_WITH_TIME == "bytime" ]] && [[ -n ${PW_GAME_TIME[1]} ]] ; then for i in "${PW_AMOUNT_OLD_DESKTOP[@]}" ; do for j in "${PW_AMOUNT_OLD_DESKTOP[@]}" ; do if (( ${PW_GAME_TIME[$i]} > ${PW_GAME_TIME[$j]} )) ; then @@ -718,6 +732,29 @@ else done done fi + # Переопределение элементов в массивах в зависимости от того, какое приложение в последний раз использовалось + if [[ $SORT_WITH_TIME == "lastlaunch" ]] && [[ -n ${PW_LAST_LAUNCH[1]} ]] ; then + for i in "${PW_AMOUNT_OLD_DESKTOP[@]}" ; do + for j in "${PW_AMOUNT_OLD_DESKTOP[@]}" ; do + if (( ${PW_LAST_LAUNCH[$i]} > ${PW_LAST_LAUNCH[$j]} )) ; then + tmp_0=${PW_LAST_LAUNCH[$i]} + tmp_1=${PW_ALL_DF[$i]} + tmp_2=${PW_NAME_D_ICON[$i]} + tmp_4=${PW_ICON_PATH[$i]} + + PW_LAST_LAUNCH[i]=${PW_LAST_LAUNCH[$j]} + PW_ALL_DF[i]=${PW_ALL_DF[$j]} + PW_NAME_D_ICON[i]=${PW_NAME_D_ICON[$j]} + PW_ICON_PATH[i]=${PW_ICON_PATH[$j]} + + PW_LAST_LAUNCH[j]=$tmp_0 + PW_ALL_DF[j]=$tmp_1 + PW_NAME_D_ICON[j]=$tmp_2 + PW_ICON_PATH[j]=$tmp_4 + fi + done + done + fi # Генерация .desktop баттанов для главного меню IFS=$'\n' PW_GENERATE_BUTTONS="--field= ${translations[Create shortcut...]}!${PW_GUI_ICON_PATH}/find_48.svg!:FBTNR%@bash -c \"button_click --normal pw_find_exe\"%"