xdg-sanity/xdg-sanity.sh

18 lines
439 B
Bash
Executable File

#!/bin/sh
echo "Determining MIME type of $1:"
MIME=$(curl -I -s "$1" | sed -n -e 's/^content-type: //p' | sed -e 's/;.\+//g' | tr -d '\r')
echo $MIME
BROWSER=$(cat /etc/xdg-sanity.conf | sed -n -e 's/^browser = //p' )
# add application/x-xpinstall text/xml application/xhtml+xml x-scheme-handler/https handling
# fix text/html; charset=utf-8 handling
if [ "$MIME" = "text/html" ]
then
$BROWSER $1
else
handlr launch "$MIME" -- "$1"
fi