Unverified Commit a84b860c authored by Mikhail Tergoev's avatar Mikhail Tergoev Committed by GitHub

Merge pull request #49 from Maks1mS/feat/rename-shortcut

feat: Add ability to set shortcut name
parents 7997f88f ffb52f13
...@@ -46,7 +46,9 @@ if [[ "${update_loc}" == "RUS" ]] ; then ...@@ -46,7 +46,9 @@ if [[ "${update_loc}" == "RUS" ]] ; then
export inst_set="Выбор" export inst_set="Выбор"
export inst_set_top="Установка ${portname}" export inst_set_top="Установка ${portname}"
export ss_done="Ярлык создан в каталоге ${portname}.\nДобавить его в МЕНЮ -> Игры и на Рабочий стол?" export sc_info="Ярлык будет создан в каталоге ${portname}."
export sc_name="Название"
export sc_menu_desktop="Добавить ярлык в МЕНЮ -> Игры и на Рабочий стол"
export inst_succ="Установка завершена успешно!" export inst_succ="Установка завершена успешно!"
...@@ -291,7 +293,10 @@ elif [[ "${update_loc}" == "ENG" ]] ; then ...@@ -291,7 +293,10 @@ elif [[ "${update_loc}" == "ENG" ]] ; then
export inst_set="Choices" export inst_set="Choices"
export inst_set_top="Instaling ${portname}" export inst_set_top="Instaling ${portname}"
export ss_done="The shortcut was created in the ${portname} directory.\n Add it to MENU -> GAMES and Desktop?" export sc_info="The shortcut will be created in the ${portname} directory."
export sc_name="Name"
export sc_menu_desktop="Add shortcut to MENU -> GAMES and Desktop"
export inst_succ="The installation was successful." export inst_succ="The installation was successful."
export port_upd1="New update for ${portname}" export port_upd1="New update for ${portname}"
......
...@@ -463,38 +463,49 @@ gui_vkBasalt () { ...@@ -463,38 +463,49 @@ gui_vkBasalt () {
portwine_create_shortcut () { portwine_create_shortcut () {
pw_create_gui_png pw_create_gui_png
name_desktop="${PORTPROTON_NAME}" name_desktop="${PORTPROTON_NAME}"
try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop" OUTPUT=$("${pw_yad}" --title="${inst_set}." --form --borders=3 \
echo "[Desktop Entry]" > "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Name=${PORTPROTON_NAME}" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
if [ -z "${PW_CHECK_AUTOINSTAL}" ]
then echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
>> "${PORT_WINE_PATH}/${name_desktop}.desktop"
else echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
>> "${PORT_WINE_PATH}/${name_desktop}.desktop"
fi
echo "Type=Application" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Categories=Game" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "StartupNotify=true" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Path="${PORT_SCRIPTS_PATH}/"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Icon="${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
chmod u+x "${PORT_WINE_PATH}/${name_desktop}.desktop"
"${pw_yad}" --title="${inst_set}." --form --borders=3 \
--window-icon "$PW_GUI_ICON_PATH/port_proton.png" \ --window-icon "$PW_GUI_ICON_PATH/port_proton.png" \
--image "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" \ --image "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" \
--field="\n <b>${name_desktop}.desktop</b>:LBL" "" \ --field="${sc_info}":LBL "" \
--field="\n ${ss_done}:LBL" "" \ --field="${sc_name}:" "${name_desktop}" \
--button="$loc_gui_no":1 \ --field="${sc_menu_desktop}":CHK "TRUE" \
--button="$loc_gui_yes":0 --button="$loc_gui_create_shortcut":0)
if [ $? -eq "0" ]; then if [ $? -eq "0" ]; then
try_remove_file "${HOME}/.local/share/applications/${name_desktop}.desktop" name_desktop=$(echo "$OUTPUT" | awk -F'|' '{ print $2 }')
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/.local/share/applications/" create_menu_desktop_shortcut=$(echo "$OUTPUT" | awk -F'|' '{ print $3 }')
if [[ -d "${HOME}/Desktop" ]] ; then
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Desktop/" try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop"
elif [[ -d "${HOME}/Рабочий стол" ]] ; then
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Рабочий стол/" mv -f "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" "${PORT_WINE_PATH}/data/img/${name_desktop}.png"
echo "[Desktop Entry]" > "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Name=${name_desktop}" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
if [ -z "${PW_CHECK_AUTOINSTAL}" ]
then echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
>> "${PORT_WINE_PATH}/${name_desktop}.desktop"
else echo "Exec=env "\"${PORT_SCRIPTS_PATH}/start.sh\" \"${portwine_exe}\" "" \
>> "${PORT_WINE_PATH}/${name_desktop}.desktop"
fi
echo "Type=Application" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Categories=Game" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "StartupNotify=true" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Path="${PORT_SCRIPTS_PATH}/"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
echo "Icon="${PORT_WINE_PATH}/data/img/${name_desktop}.png"" >> "${PORT_WINE_PATH}/${name_desktop}.desktop"
chmod u+x "${PORT_WINE_PATH}/${name_desktop}.desktop"
if [[ "${create_menu_desktop_shortcut}" == "TRUE" ]]; then
try_remove_file "${HOME}/.local/share/applications/${name_desktop}.desktop"
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/.local/share/applications/"
if [[ -d "${HOME}/Desktop" ]] ; then
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Desktop/"
elif [[ -d "${HOME}/Рабочий стол" ]] ; then
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Рабочий стол/"
fi
fi fi
[[ "$1" != silent ]] && xdg-open "${PORT_WINE_PATH}" 2>1 >/dev/null &
fi fi
[[ "$1" != silent ]] && xdg-open "${PORT_WINE_PATH}" 2>1 >/dev/null &
} }
portwine_delete_shortcut () { portwine_delete_shortcut () {
......
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