#!/bin/bash DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")" function error { echo -e "\\e[91m$1\\e[39m" exit 1 } if command -v chromium-browser;then browser="$(command -v chromium-browser)" elif command -v chromium;then 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