aboutsummaryrefslogtreecommitdiff
path: root/chromium-profile
blob: ca8cd20181369c32a1c09ffa46c2a45a9beb501b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
#
# Wrapper around chromium to enable extensions
# See https://wiki.debian.org/Chromium#Extensions
#     https://www.chromium.org/developers/creating-and-using-profiles
#     https://www.chromium.org/Home/chromium-security/site-isolation

# Parameters
BASENAME="`basename $0`"
BASE="$HOME/.config/chromium-profiles"

# Check
if [ -z "$1" ]; then
  # Autoprint as usage
  #cat $0

  if [ -d "$BASE" ]; then
    PROFILES="`ls $BASE | xargs`"
  fi

  echo "usage: $BASENAME <profile>"

  if [ ! -z "$PROFILES" ]; then
    echo "available profiles: $PROFILES"
  fi

  exit 1
fi

if which chromium &> /dev/null; then
  PROFILE="$BASE/$1"

  # Copy default profile if available, or start a new one
  if [ ! -d "$PROFILE" ] && [ -d "$BASE/default" ]; then
    cp -a "$BASE/default" "$PROFILE"
  else
    mkdir -p "$PROFILE"
  fi

  shift

  #CHROMIUM_FLAGS="$CHROMIUM_FLAGS --site-per-process --enable-remote-extensions" chromium --user-data-dir="$PROFILE" $*
  CHROME_CONFIG_HOME="$PROFILE" CHROMIUM_FLAGS="$CHROMIUM_FLAGS --site-per-process --enable-remote-extensions" chromium $*
fi