From 7f28b86f44bca5fb9e7141c0edc8437ab49bb59c Mon Sep 17 00:00:00 2001 From: Botspot Date: Mon, 30 Nov 2020 14:19:19 -0600 Subject: [PATCH] substancial improvements to boxy svg app --- apps/Boxy SVG/install | 69 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/apps/Boxy SVG/install b/apps/Boxy SVG/install index 58cc8d2..6019c58 100755 --- a/apps/Boxy SVG/install +++ b/apps/Boxy SVG/install @@ -7,13 +7,72 @@ function error { exit 1 } -git clone https://github.com/Botspot/Boxy-SVG-RPi -cd Boxy-SVG-RPi -unzip ./boxysvgrpi.zip if command -v chromium-browser;then - chromium-browser --load-and-launch-app=$(pwd)/boxysvgrpi & + browser="$(command -v chromium-browser)" elif command -v chromium;then - chromium --load-and-launch-app=$(pwd)/boxysvgrpi + browser="$(command -v chromium)" else error "You must have Chromium Browser installed to use the Boxy SVG Chrome App!" fi + +git clone https://github.com/Botspot/Boxy-SVG-RPi +cd Boxy-SVG-RPi +unzip ./boxysvgrpi.zip + +if [ -f "$HOME/.config/chromium/Default/Preferences" ];then + pref_file="$HOME/.config/chromium/Default/Preferences" + foundpref=1 +elif [ -f "$HOME/snap/chromium/common/chromium/Default/Preferences" ];then + pref_file="$HOME/snap/chromium/common/chromium/Default/Preferences" + foundpref=1 +else + foundpref=0 + echo "Preferences file not found." +fi + +if [ $foundpref == 1 ];then + echo "Enabling Extension Developer Mode in Chromium..." + if [ -z "$(cat "$pref_file" | grep developer_mode)" ];then + sed -i 's/},"first_run_tabs"/,"ui":{"developer_mode":true}},"first_run_tabs"/g' "$pref_file" + else + sed -i 's/"developer_mode":false/"developer_mode":true/g' "$pref_file" + fi + if [ -z "$(cat "$pref_file" | grep 'developer_mode":true')" ];then + foundpref=0 + echo "Tried to enable developer mode in chromium but it failed." + fi +fi + +if [ $foundpref == 0 ];then + echo "Failed to enable developer mode in chromium's preferences file. Please launch Chromium, go to the chrome://extensions website, and enable Developer Mode manually." + sleep 5 + echo -n "Press Enter once you've done this. " + read enter +else + pkill chromium +fi + +echo "Now installing Boxy SVG..." + +$browser & +sleep 10 +$browser --load-and-launch-app=$(pwd)/boxysvgrpi & + +if [ -f ~/.local/share/applications/chrome-gaoogdonmngmdlbinmiclicjpbjhgomg-Default.desktop ];then + echo "Categories=Graphics;" > ~/.local/share/applications/chrome-gaoogdonmngmdlbinmiclicjpbjhgomg-Default.desktop +else + echo "Warning: Chromium did not create a menu button for Boxy SVG for some reason." + sleep 3 + echo "Forcibly creating the menu button now, but it might not work." + echo "#!/usr/bin/env xdg-open +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Name=Boxy SVG +Exec=$browser --profile-directory=Default --app-id=gaoogdonmngmdlbinmiclicjpbjhgomg +Icon=chrome-gaoogdonmngmdlbinmiclicjpbjhgomg-Default +StartupWMClass=crx_gaoogdonmngmdlbinmiclicjpbjhgomg +Categories=Graphics;" > ~/.local/share/applications/chrome-gaoogdonmngmdlbinmiclicjpbjhgomg-Default.desktop +fi +