From 92d74e91bf8e4a10888e0eeb2c1e70a20b1f0767 Mon Sep 17 00:00:00 2001 From: BrainwreckedTech <--get> Date: Tue, 19 Jan 2021 05:53:07 -0500 Subject: [PATCH] Account for spaces in app names. --- mkwebapp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/mkwebapp b/mkwebapp index cf4f17b..5154c59 100755 --- a/mkwebapp +++ b/mkwebapp @@ -117,37 +117,39 @@ case "${WA_BRWSR}" in "iridium") WASUFFIX="pwa" ; BRWSRBIN="iridium-browser" ; break;; esac +WAPPFLNM="$(echo ${WAPPNAME} | tr '[:upper:] ' '[:lower:]-')" + ### PLACES FOR STUFF if [ "${WA_BRWSR}" = "epiphany" ]; then WAPP_PRE="org.gnome.Epiphany.WebApp-" - WAPP_DIR="${SHAREDIR}/${WAPP_PRE}${WAPPNAME,,}" + WAPP_DIR="${SHAREDIR}/${WAPP_PRE}${WAPPFLNM}" WAPP_ICO="${WAPP_DIR}/app-icon.${WAPPICON##*.}" - WAPP_DTF="${WAPP_DIR}/${WAPP_PRE}${WAPPNAME,,}.desktop" + WAPP_DTF="${WAPP_DIR}/${WAPP_PRE}${WAPPFLNM}.desktop" else WAPP_DIR="${APPS_DIR}/${WASUFFIX}" - WAPP_ICO="${ICONSDIR}/${WASUFFIX}/${WAPPNAME,,}.${WAPPICON##*.}" - WAPP_DTF="${APPS_DIR}/${WASUFFIX}/${WAPPNAME,,}.desktop" + WAPP_ICO="${ICONSDIR}/${WASUFFIX}/${WAPPFLNM}.${WAPPICON##*.}" + WAPP_DTF="${APPS_DIR}/${WASUFFIX}/${WAPPFLNM}.desktop" fi ### PROFILE SETTINGS if [ "${WASUFFIX}" = "pwa" ]; then WAPP_DPF="${CONF_DIR}/${WA_BRWSR}/${WASUFFIX}-default" - WAPP_PRF="${CONF_DIR}/${WA_BRWSR}/${WASUFFIX}-${WAPPNAME,,}" + WAPP_PRF="${CONF_DIR}/${WA_BRWSR}/${WASUFFIX}-${WAPPFLNM}" elif [ "${WASUFFIX}" = "ssb" ]; then ### CREATE DIRECTORY FOR FIREFOX CACHE - printf -- ':: ' && mkdir -pv "/run/user/${UID}/ssb-${WAPPNAME,,}" + printf -- ':: ' && mkdir -pv "/run/user/${UID}/ssb-${WAPPFLNM}" ### CREATE A NEW PROFILE FOR THIS WEB APP - echo /usr/bin/firefox -CreateProfile "ssb-${WAPPNAME,,}" -no-remote + echo /usr/bin/firefox -CreateProfile "ssb-${WAPPFLNM}" -no-remote ### FIND THE DIRECTORY FIREFOX CREATED - FFPFDIR="$(find "${HOME}/.mozilla/firefox" -type d -name '*'."ssb-${WAPPNAME,,}")" + FFPFDIR="$(find "${HOME}/.mozilla/firefox" -type d -name '*'."ssb-${WAPPFLNM}")" ### INJECT PREFERENCES - USRPREF1='user_pref("browser.cache.disk.parent_directory", "/run/user/'"${UID}"'/ssb-'"${WAPPNAME,,}"');' + USRPREF1='user_pref("browser.cache.disk.parent_directory", "/run/user/'"${UID}"'/ssb-'"${WAPPFLNM}"');' USRPREF2='user_pref("browser.ssb.enabled", true);' USRPREF3='user_pref("extensions.pocket.enabled", false);' USRPREF4='user_pref("privacy.donottrackheader.enabled", true);' @@ -178,15 +180,15 @@ curl -s "${WAPPICON}" -o "${WAPP_ICO}" -w ':: curl: wrote "%{url_effective}" to ### CREATE COMMAND LINE FOR THE .desktop FILE case "${WASUFFIX}" in ewa) WAPP_CMD="${BRWSRBIN} --application-mode --profile='${WAPP_DIR}' ${WAPPADDR}";; - pwa) WAPP_CMD="${BRWSRBIN} --user-data-dir='${CONF_DIR}/${WA_BRWSR}/pwa-${WAPPNAME,,}' --class pwa-${WAPPNAME,,} --no-first-run --no-default-browser-check --app='${WAPPADDR}'";; - ssb) WAPP_CMD="${BRWSRBIN} -P ssb-${WAPPNAME,,} --class ssb-${WAPPNAME,,} --no-remote --ssb ${WAPPADDR}";; + pwa) WAPP_CMD="${BRWSRBIN} --user-data-dir='${CONF_DIR}/${WA_BRWSR}/pwa-${WAPPFLNM}' --class pwa-${WAPPFLNM} --no-first-run --no-default-browser-check --app='${WAPPADDR}'";; + ssb) WAPP_CMD="${BRWSRBIN} -P ssb-${WAPPFLNM} --class ssb-${WAPPFLNM} --no-remote --ssb ${WAPPADDR}";; esac ### CREATE WMCLASS FOR THE .desktop FILE case "${WASUFFIX}" in - ewa) WAWMCLAS="${WAPP_PRE}${WAPPNAME,,}";; - pwa) WAWMCLAS="pwa-${WAPPNAME,,}";; - ssb) WAWMCLAS="ssb-${WAPPNAME,,}";; + ewa) WAWMCLAS="${WAPP_PRE}${WAPPFLNM}";; + pwa) WAWMCLAS="pwa-${WAPPFLNM}";; + ssb) WAWMCLAS="ssb-${WAPPFLNM}";; esac ### CREATE A DESKTOP ENTRY FOR THE WEB APP @@ -208,15 +210,15 @@ chmod -v +x "${WAPP_DTF}" if [ -n "${WAPP_PRE}" ]; then printf -- ':: ln -s: ' - ln -sv "../${WAPP_PRE}${WAPPNAME,,}/${WAPP_PRE}${WAPPNAME,,}.desktop" "${APPS_DIR}/${WAPP_PRE}${WAPPNAME,,}.desktop" + ln -sv "../${WAPP_PRE}${WAPPFLNM}/${WAPP_PRE}${WAPPFLNM}.desktop" "${APPS_DIR}/${WAPP_PRE}${WAPPFLNM}.desktop" fi ### CREATE A PROXIED VERSION WAPP_DTF="${WAPP_DTF/.desktop/.proxied.desktop}" [ "${WASUFFIX}" = "pwa" ] && PRX_MTHD="Local Proxy" && WAPP_CMD="${WAPP_CMD} --proxy-server='socks://127.0.0.1:8080'" [ ! "${WASUFFIX}" = "pwa" ] && PRX_MTHD="Proxychains" && WAPP_CMD="proxychains ${WAPP_CMD}" -[ ! "${WASUFFIX}" = "ewa" ] && WAPP_CMD="${WAPP_CMD/--class ${WASUFFIX}-${WAPPNAME,,}/--class ${WASUFFIX}-${WAPPNAME,,}.proxy}" -WAWMCLAS="${WAWMCLAS/${WAPPNAME,,}/${WAPPNAME,,}.proxy}" +[ ! "${WASUFFIX}" = "ewa" ] && WAPP_CMD="${WAPP_CMD/--class ${WASUFFIX}-${WAPPFLNM}/--class ${WASUFFIX}-${WAPPFLNM}.proxy}" +WAWMCLAS="${WAWMCLAS/${WAPPFLNM}/${WAPPFLNM}.proxy}" DTE0="[Desktop Entry]" DTE1="Name=${WAPPNAME} (${WASUFFIX^^}) via ${PRX_MTHD}" @@ -236,5 +238,5 @@ chmod -v +x "${WAPP_DTF}" if [ -n "${WAPP_PRE}" ]; then printf -- ':: ln -s: ' - ln -sv "../${WAPP_PRE}${WAPPNAME,,}/${WAPP_PRE}${WAPPNAME,,}.proxied.desktop" "${APPS_DIR}/${WAPP_PRE}${WAPPNAME,,}.proxied.desktop" + ln -sv "../${WAPP_PRE}${WAPPFLNM}/${WAPP_PRE}${WAPPFLNM}.proxied.desktop" "${APPS_DIR}/${WAPP_PRE}${WAPPFLNM}.proxied.desktop" fi