Account for spaces in app names.

master
BrainwreckedTech 4 years ago
parent 064d2386b9
commit 92d74e91bf

@ -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

Loading…
Cancel
Save