#!/bin/sh
# open a html file in default browser, not text editor,
# when text editor is set as default app for html files
url=file:///path/to/file.html
protocol=http
app=$(xdg-mime query default x-scheme-handler/$protocol)
# example: chromium-browser.desktop
[ -z "$app" ] && {
echo "error: xdg-mime could not find default app for protocol $protocol"
exit 1
}
app=$(basename $app .desktop)
gtk-launch $app "$url"