Commit 2bdcf4ee authored by Vladislav's avatar Vladislav

Added recommend_dpi and fixes_after_update

parent 7b0579e3
......@@ -7,7 +7,7 @@
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-01 02:46+0500\n"
"POT-Creation-Date: 2024-11-02 10:04+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -1381,6 +1381,9 @@ msgid "If downloading steam covers is enabled, they will be downloaded and "
"is unavailable for some reason)"
msgstr ""
msgid "Recommended value"
msgstr ""
msgid "Choose a graphics card to run the game"
msgstr ""
......@@ -1388,10 +1391,10 @@ msgid "Select which video card will be used to run the game (used for all "
"running games and programs in PortProton)"
msgstr ""
msgid "Force dpi for fonts"
msgid "Force dpi"
msgstr ""
msgid "Here you can set forced dpi for fonts in wine"
msgid "Here you can set forced dpi for applications wine"
msgstr ""
msgid "Choice wine audio driver"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-01 02:43+0500\n"
"POT-Creation-Date: 2024-11-02 10:04+0500\n"
"PO-Revision-Date: 2024-10-26 13:58+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
......@@ -1804,6 +1804,9 @@ msgstr ""
"crearán. (La desactivación se proporciona en los casos en que su descarga no "
"esté disponible por algún motivo)"
msgid "Recommended value"
msgstr ""
msgid "Choose a graphics card to run the game"
msgstr "Elige una tarjeta gráfica para ejecutar el juego"
......@@ -1814,10 +1817,10 @@ msgstr ""
"Selecciona qué tarjeta de vídeo se utilizará para ejecutar el juego (se "
"utiliza para todos los juegos y programas en ejecución en PortProton)"
msgid "Force dpi for fonts"
msgid "Force dpi"
msgstr ""
msgid "Here you can set forced dpi for fonts in wine"
msgid "Here you can set forced dpi for applications wine"
msgstr ""
msgid "Choice wine audio driver"
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-01 02:43+0500\n"
"PO-Revision-Date: 2024-11-01 02:44+0500\n"
"POT-Creation-Date: 2024-11-02 10:04+0500\n"
"PO-Revision-Date: 2024-11-02 10:05+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ru_RU\n"
......@@ -1782,6 +1782,9 @@ msgstr ""
"создаваться. (Отключение предусмотрено в тех случаях, когда их скачивание по "
"каким-то причинам недоступно)"
msgid "Recommended value"
msgstr "Рекомендуемое значение"
msgid "Choose a graphics card to run the game"
msgstr "Выбрать видеокарту для запуска игры"
......@@ -1792,12 +1795,11 @@ msgstr ""
"Выбор видеокарты для запуска игры (используется для всех запущенных игр и "
"программ в PortProton)"
msgid "Force dpi for fonts"
msgstr "Принудительное разрешение шрифтов"
msgid "Force dpi"
msgstr "Принудительный масштаб"
msgid "Here you can set forced dpi for fonts in wine"
msgstr ""
"Здесь вы можете установить принудительное разрешение для шрифтов в Wine"
msgid "Here you can set forced dpi for applications wine"
msgstr "Здесь вы можете установить принудительный масштаб для приложений wine"
msgid "Choice wine audio driver"
msgstr "Выбрать звуковой драйвер"
......
......@@ -1296,11 +1296,20 @@ get_and_set_reg_file () {
name_block=${name_block//\\/\\\\\\\\\\\\\\}
name_block=${name_block//*/\\[$name_block}
name_block="${name_block//*/${name_block//\\/\\\\}\\]}"
if [[ -n $name_for_new_block ]] ; then
find_block=$(grep -n "$name_block" "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/$name_for_new_block.reg")
else
find_block=$(grep -n "$name_block" "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/"*.reg)
fi
if [[ -n $find_block ]] ; then
if [[ -n $name_for_new_block ]] ; then
find_file="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/$name_for_new_block.reg"
find_line=${find_block//:*/}
else
find_file=${find_block//:*/}
find_line=${find_block//$find_file:/}
find_line=${find_line//:*/}
fi
count=-1
while IFS= read -r line_reg ; do
((count++))
......@@ -1321,7 +1330,7 @@ get_and_set_reg_file () {
if [[ -z $find_block ]] ; then
if [[ -n $name_for_new_block ]] ; then
sed -i '$a\\n'"$name_block\n" "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/$name_for_new_block.reg"
find_file=${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/$name_for_new_block.reg
find_file="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/$name_for_new_block.reg"
find_line=$(wc -l "$find_file" | awk -F" " '{print $1}')
find_line=$(( find_line - 1 ))
else
......@@ -1359,6 +1368,32 @@ convert_dec_and_hex () {
esac
}
recommend_dpi () {
local height=$1
if [[ -z "$height" ]] ; then
echo "disabled"
return 1
fi
local dpi=$(( height / 9 ))
echo "$dpi"
}
fixes_after_update () {
local fixes_path line fixes_info IFS
fixes_info=$1
fixes_path="$PORT_WINE_TMP_PATH/fixes_apply"
[[ ! -f $fixes_path ]] && touch "$fixes_path"
while IFS= read -r line ; do
if [[ $line == "$fixes_info" ]] ; then
return 1
fi
done < "$fixes_path"
echo "$fixes_info" >> "$fixes_path"
return 0
}
restart_pp () {
case "$1" in
--userconf) export RESTART_PP_USED="userconf" ;;
......@@ -3779,7 +3814,12 @@ start_portwine () {
fi
if [[ "$PW_WINE_DPI_VALUE" != "disabled" ]] ; then
get_and_set_reg_file --add 'Control Panel\Desktop' 'LogPixels' 'REG_DWORD' "${PW_WINE_DPI_VALUE// (*/}" "user"
if [[ "$PW_WINE_DPI_VALUE" == "recommended" ]] ; then
PW_RECOMMENDED_DPI=$(recommend_dpi "${PW_SCREEN_RESOLUTION:5:8}")
get_and_set_reg_file --add 'Control Panel\Desktop' 'LogPixels' 'REG_DWORD' "$PW_RECOMMENDED_DPI" "user"
else
get_and_set_reg_file --add 'Control Panel\Desktop' 'LogPixels' 'REG_DWORD' "$PW_WINE_DPI_VALUE" "user"
fi
fi
if [[ "$PW_USE_NATIVE_WAYLAND" == "1" ]] ; then
......@@ -5624,6 +5664,9 @@ gui_userconf () {
SORT_WITH_TIME="enabled"
fi
if [[ $PW_WINE_DPI_VALUE == "recommended" ]] ; then
PW_WINE_DPI_VALUE="${translations[Recommended value]}"
fi
if [[ -n "$PW_WINE_DPI_VALUE" ]] \
&& [[ "$PW_WINE_DPI_VALUE" != "disabled" ]]
then
......@@ -5632,10 +5675,10 @@ gui_userconf () {
YAD_DPI_VAR="disabled"
fi
"${pw_yad}" --plug=$KEY_USERCONF_GUI --tabnum="2" --form --columns=1 --separator="@" --homogeneous-row \
"${pw_yad}" --plug=$KEY_USERCONF_GUI --tabnum="2" --form --columns=1 --separator="%" --homogeneous-row \
--gui-type-text="$PANED_GUI_TYPE_TEXT_DOWN" --gui-type-layout="$PANED_GUI_TYPE_LAYOUT_DOWN" \
--field="${translations[Choose a graphics card to run the game]}!${translations[Select which video card will be used to run the game (used for all running games and programs in PortProton)]} :CB" "$(combobox_fix --disabled "$GPU_VAR" "$GET_GPU_NAMES")" \
--field="${translations[Force dpi for fonts]}!${translations[Here you can set forced dpi for fonts in wine]} :CB" "$(combobox_fix --disabled "$YAD_DPI_VAR" "96 (100%)!120 (125%)!144 (150%)!168 (175%)!192 (200%)!216 (225%)!240 (250%)!264 (275%)!288 (300%)")" \
--field="${translations[Force dpi]}!${translations[Here you can set forced dpi for applications wine]} :CB" "$(combobox_fix --disabled "$YAD_DPI_VAR" "${translations[Recommended value]}!96!120!144!168!192!216!240!264!288")" \
--field="${translations[Choice wine audio driver]}!${translations[Fixes sound popling if choice alsa]} :CB" "$(combobox_fix --disabled "$SOUND_DRIVER_VAR" "alsa!oss!pulse")" \
--field="${translations[Choice gui themes]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "default!compact!classic")" \
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "enabled")" \
......@@ -5670,10 +5713,13 @@ gui_userconf () {
gui_open_user_conf
;;
166)
IFS='@' read -r -a PW_ADD_SETTINGS_UC <"${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb"
IFS='%' read -r -a PW_ADD_SETTINGS_UC <"${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb"
IFS="$orig_IFS"
PW_GPU_USE="${PW_ADD_SETTINGS_UC[0]}"
PW_WINE_DPI_VALUE="${PW_ADD_SETTINGS_UC[1]}"
if [[ $PW_WINE_DPI_VALUE == "${translations[Recommended value]}" ]] ; then
PW_WINE_DPI_VALUE="recommended"
fi
PW_SOUND_DRIVER_USE="${PW_ADD_SETTINGS_UC[2]}"
GUI_THEME="${PW_ADD_SETTINGS_UC[3]}"
DESKTOP_WITH_TIME="${PW_ADD_SETTINGS_UC[4]}"
......
......@@ -248,6 +248,17 @@ if [[ ! $PW_GUI_START =~ (PANED|NOTEBOOK) ]] ; then
export PW_GUI_START="NOTEBOOK"
fi
# TODO:fixes_after_update
if fixes_after_update "2371: Reset PW_WINE_DPI_VALUE in user.conf" ; then
sed -i '/export PW_WINE_DPI_VALUE=/d' "$USER_CONF"
unset PW_WINE_DPI_VALUE
fi
# choose wine dpi default
if [[ -z $PW_WINE_DPI_VALUE ]] ; then
echo 'export PW_WINE_DPI_VALUE="recommended"' >> "$USER_CONF"
export PW_WINE_DPI_VALUE="recommended"
fi
if check_flatpak ; then
if check_gamescope_session
then PW_TERM="env LANG=C xterm -fullscreen -bg black -fg white -e"
......
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