diff --git a/all/modules/chromium.sh b/all/modules/chromium.sh index 91e27c9..6cf0190 100755 --- a/all/modules/chromium.sh +++ b/all/modules/chromium.sh @@ -1,4 +1,6 @@ #!/bin/bash + +# TODO if non interactive then send notificaiton instead attempting command function mv_chromium () { local _ch local ch @@ -23,14 +25,20 @@ local dir mv_chromium [[ $? -ne 0 ]] && echo chromium not installed && return 1 # echo chromium executable available and moved to $(command -v _chromium) - -user=${CHROME_USER:-$1} -user=${user:-$USER} -dir=${CHROME_CONFIG_HOME:-"$HOME/.config/chromium"} -[[ $user == "$USER" ]] && dir="$HOME/.config/chromium" exe=$(command -v _chromium) -echo "$exe --user-data-dir=$dir/$user" -$exe --user-data-dir=$dir/$user +[[ ! $exe ]] && echo _chromium not set && return 1 +user=${CHROME_USER} +[[ $1 && ( ! $1 == -* ) ]] && user=$1 && shift +user=${user:-$USER} +if [[ $user == "$USER" ]]; then + unset CHROME_CONFIG_HOME + $exe "$@" + else + [[ $user == "incognito" ]] && set -- "$@" "-incognito" + dir=${CHROME_CONFIG_HOME:-"$HOME/.local/share/chromium"} + echo "$exe $@ --user-data-dir=$dir/$user" + $exe "$@" --user-data-dir=$dir/$user +fi } # # if script was executed then call the function