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
export inst_set="Выбор"
export inst_set_top="Установка ${portname}"
export ss_done="Ярлык создан в каталоге ${portname}.\nДобавить его в МЕНЮ -> Игры и на Рабочий стол?"
export sc_info="Ярлык будет создан в каталоге ${portname}."
export sc_name="Название"
export sc_menu_desktop="Добавить ярлык в МЕНЮ -> Игры и на Рабочий стол"
export inst_succ="Установка завершена успешно!"
......@@ -291,7 +293,10 @@ elif [[ "${update_loc}" == "ENG" ]] ; then
export inst_set="Choices"
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 port_upd1="New update for ${portname}"
......
......@@ -463,9 +463,23 @@ gui_vkBasalt () {
portwine_create_shortcut () {
pw_create_gui_png
name_desktop="${PORTPROTON_NAME}"
OUTPUT=$("${pw_yad}" --title="${inst_set}." --form --borders=3 \
--window-icon "$PW_GUI_ICON_PATH/port_proton.png" \
--image "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" \
--field="${sc_info}":LBL "" \
--field="${sc_name}:" "${name_desktop}" \
--field="${sc_menu_desktop}":CHK "TRUE" \
--button="$loc_gui_create_shortcut":0)
if [ $? -eq "0" ]; then
name_desktop=$(echo "$OUTPUT" | awk -F'|' '{ print $2 }')
create_menu_desktop_shortcut=$(echo "$OUTPUT" | awk -F'|' '{ print $3 }')
try_remove_file "${PORT_WINE_PATH}/${name_desktop}.desktop"
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=${PORTPROTON_NAME}" >> "${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"
......@@ -476,16 +490,10 @@ portwine_create_shortcut () {
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"
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"
"${pw_yad}" --title="${inst_set}." --form --borders=3 \
--window-icon "$PW_GUI_ICON_PATH/port_proton.png" \
--image "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.png" \
--field="\n <b>${name_desktop}.desktop</b>:LBL" "" \
--field="\n ${ss_done}:LBL" "" \
--button="$loc_gui_no":1 \
--button="$loc_gui_yes":0
if [ $? -eq "0" ]; then
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
......@@ -494,7 +502,10 @@ portwine_create_shortcut () {
cp -f "${PORT_WINE_PATH}/${name_desktop}.desktop" "${HOME}/Рабочий стол/"
fi
fi
[[ "$1" != silent ]] && xdg-open "${PORT_WINE_PATH}" 2>1 >/dev/null &
fi
}
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