#!/bin/bash
export WEBKIT_DISABLE_COMPOSITING_MODE=1

file=${1}
title=${2:-"Mabox Linux Doc"}
width=${3:-800}
height=${4:-600}

stdbuf -oL -e0 yad  --title="${title}" --window-icon=mbcc --borders=0 \
--width=${width} --height=${height} \
--no-buttons --no-escape --html --uri="${1}" --print-uri \
| while read -r line; do
	case ${line%:*} in
		https) xdg-open "${line}" &;;
		run)  ${line##*//} &;;
		config)  geany  "$HOME/${line#*//}" &;;
        term) terminator -e "${line#*//}" &;;
        termo) terminator -e "${line#*//};bash" &;;
		*)		echo "No URI";;
	esac
done
