aboutsummaryrefslogtreecommitdiffstats
path: root/browser-launcher
blob: 0213cbb77b5900e09a719c2c685f76c484915e88 (plain) (blame)
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
#!/bin/bash

POSITIONAL_ARGS=()

while [[ $# -gt 0 ]]; do
  case $1 in
    --*)
      POSITIONAL_ARGS+=("$1")
      shift
      ;;
    -*)
      POSITIONAL_ARGS+=("-$1")
      shift
      ;;
    *)
      POSITIONAL_ARGS+=("$1")
      shift
      ;;
  esac
done

POSITIONAL_ARGS+=(
  "--marionette"
  "--preferences"
)
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters

if which firefox >/dev/null 2>/dev/null; then
  exec firefox "$@"
elif which librewolf >/dev/null 2>/dev/null; then
  # not first pick due to it dying somehow randomly
  exec librewolf "$@"
else
  echo "No Supported Browser!" 1>&2;
  exit 1
fi