Advertisement
s243a

/usr/local/bin/defaultbrowser (TazPup64 - s243a)

Apr 19th, 2019
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.77 KB | None | 0 0
  1. #!/bin/sh
  2. #set -x
  3. if [ "$TEXTDOMAIN" = 'tazpanel' ]; then
  4.   BROWSER_CHOICES=( tazweb midori palemoon firefox opera iron chomium chrome netsurf lynx )
  5. else
  6.   BROWSER_CHOICES=( opera palemoon firefox tazweb midori iron chomium chrome netsurf lynx )
  7. fi
  8.  
  9. for  BROWSER_OPTION in "${BROWSER_CHOICES[@]}"; do  
  10.   case "$BROWSER_OPTION" in
  11.   opera|iron|iron-linux|chromium|chrome) #Maybe create a symblink if the name doesn't match
  12.   if [ ! -z "`which opera`" ]; then
  13.     if [ "`id -u`" -eq 0 ]; then
  14.       exec "$BROWSER_OPTION" --no-sandbox "$@"
  15.       break
  16.     else
  17.       exec opera "$BROWSER_OPTION"
  18.       break
  19.     fi
  20.   fi
  21.   ;;
  22.   palemoon)
  23.     if [ -f "/opt/palemoon/palemoon" ]; then
  24.       CMD=/opt/palemoon/palemoon
  25.     elif [ ! -z "`which palemoon`" ]; then
  26.       CMD="palemoon"
  27.     else
  28.       continue
  29.     fi
  30.     exec "$CMD" "$@"
  31.     break
  32.     ;;
  33.   firefox*)
  34.     if [ -f "/opt/mozilla/firefox/firefox" ] && [ "$BROWSER_OPTION" = "firefox-official" ]; then
  35.       #Firefox craches when you drag tabs
  36.       #exec apulse /opt/mozilla/firefox/firefox "$@"
  37.       CMD=/opt/mozilla/firefox/firefox
  38.     elif [ ! -z `which "$BROWSER_OPTION"` ]; then #we expect $BROWSER_OPTION to be either firefox or firefox-official
  39.       CMD="$BROWSER_OPTION"
  40.     elif [ ! -z "which firefox" ]; then
  41.       CMD=firefox
  42.     else
  43.       continue
  44.     fi
  45.     if [ -h "$CMD" ]; then
  46.       CMD=`readlink "$CMD"`
  47.     fi
  48.     if [ ! -z "`which apulse`" ] && [ $(file $CMD | grep -c ELF ) -gt 0 ]; then
  49.       CMD="apulse $CMD"
  50.     fi    
  51.     exec $CMD "$@"
  52.     ;;
  53.   *) #e.g. tazweb, nidori
  54.     if [ ! -z "`which $BROWSER_OPTION`" ]; then
  55.       #The midori in the repo doesn't work. Maybe try one from a debian repo.
  56.       exec "$BROWSER_OPTION" "$@"
  57.       break
  58.     fi
  59.   esac
  60. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement