sudo curl https://gist.githubusercontent.com/aarestu/a8f8db3c50dc4ba5c9a64a5abc9a7623/raw/web2app -o /usr/bin/web2app && sudo chmod +x /usr/bin/web2app
$ web2app -n Whatsapp https://web.whatsapp.com/
#!/bin/bash | |
if ! command -v node &> /dev/null | |
then | |
echo "nodejs could not be found" | |
sudo apt install -y nodejs | |
fi | |
if ! command -v npm &> /dev/null | |
then | |
echo "npm could not be found" | |
sudo apt install -y npm | |
fi | |
if ! command -v nativefier &> /dev/null | |
then | |
echo "nativefier could not be found" | |
sudo npm install -g nativefier | |
fi | |
TARGET_PATH=~/.local/share/nativefier | |
mkdir -p $TARGET_PATH | |
SHORTCUT_TARGET_PATH=~/.local/share/applications | |
mkdir -p $SHORTCUT_TARGET_PATH | |
ARGS_NATIVEFIER=$@ | |
while test $# -gt 0 | |
do | |
case "$1" in | |
-*) PARAM="$1" | |
;; | |
*) if [ "$PARAM" = "-n" ] || [ "$PARAM" = "--name" ] | |
then | |
APP_NAME=$1 | |
unset PARAM | |
else | |
APP_URL=$1 | |
fi | |
;; | |
esac | |
shift | |
done | |
if [ -z "$APP_NAME" ] | |
then | |
>&2 echo "Please provide -n or --name argument for the application name." | |
exit 2 | |
fi | |
regex='(https?://)[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' | |
if [[ ! $APP_URL =~ $regex ]] | |
then | |
echo "Web Link not valid" | |
exit 0 | |
fi | |
nativefier -p linux --tray -a x64 ${ARGS_NATIVEFIER} ${TARGET_PATH} | |
SHORTCUT_TARGET_PATH_FULL="${SHORTCUT_TARGET_PATH}/nativefier.web.${APP_NAME// /}.desktop" | |
echo "App built shortcut to ${SHORTCUT_TARGET_PATH_FULL}" | |
cat > "$SHORTCUT_TARGET_PATH_FULL" <<- EOM | |
[Desktop Entry] | |
Type=Application | |
Name=${APP_NAME} | |
Icon=${TARGET_PATH}/${APP_NAME}-linux-x64/resources/app/icon.png | |
Exec=${TARGET_PATH}/${APP_NAME}-linux-x64/${APP_NAME// /} | |
Categories=Network | |
EOM |
Hey man, how do you uninstall the desktop app which is created?
@MercMayhem you can remove directory under
~/.local/share/nativefier
and remove icon in:
~/.local/share/applications
Hey man, how do you uninstall the desktop app which is created?