This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-02-05 12:21:17 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# user to start MUST be first in arguments
|
|
|
|
# if not supplied then will use default
|
|
|
|
chromium_ () {
|
|
|
|
local DEFAULT=/opt/chromium
|
|
|
|
# local DEFAULT="$HOME/.local/share/chromium"
|
|
|
|
local exe="/usr/bin/chromium"
|
|
|
|
[[ ! $exe ]] && echo chromium not installed set && return 1
|
|
|
|
user=${CHROMIUM_USER}
|
|
|
|
[[ $1 && ( ! $1 == -* ) ]] && user=$1 && shift
|
2021-09-16 14:24:33 -07:00
|
|
|
[[ $1 && ( ! $1 == -* ) ]] && url=$1 && shift
|
2021-02-05 12:21:17 -08:00
|
|
|
user=${user:-$USER}
|
|
|
|
if [[ $user == "$USER" ]]; then
|
|
|
|
unset CHROME_CONFIG_HOME
|
|
|
|
echo starting chromium for $USER in default directory within users home
|
|
|
|
echo $exe "$@"
|
|
|
|
$exe "$@"
|
|
|
|
else
|
|
|
|
[[ $user == "incognito" ]] && set -- "$@" "-incognito"
|
|
|
|
dir=${CHROMIUM_HOME:-$DEFAULT}
|
|
|
|
echo "$exe $@ --user-data-dir=$dir/$user"
|
2021-09-16 14:24:33 -07:00
|
|
|
"$exe" "$@" --user-data-dir="$dir"/"$user" $url
|
2021-02-05 12:21:17 -08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# # if script was executed then call the function
|
|
|
|
(return 0 2>/dev/null) || chromium_ $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|