2022-09-01 20:17:23 -06:00
|
|
|
#!/bin/sh
|
2022-09-01 23:34:11 -06:00
|
|
|
|
2022-09-01 20:17:23 -06:00
|
|
|
echo "Determining MIME type of $1:"
|
2022-09-01 23:34:11 -06:00
|
|
|
|
2022-09-02 13:21:50 -06:00
|
|
|
MIME=$(curl -I -s "$1" | sed -n -e 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')
|
2022-09-01 20:17:23 -06:00
|
|
|
|
2022-09-01 23:34:11 -06:00
|
|
|
echo $MIME
|
|
|
|
|
2022-09-02 00:20:18 -06:00
|
|
|
BROWSER=$(cat /etc/xdg-sanity.conf | sed -n -e 's/^browser = //p' )
|
2022-09-01 23:34:11 -06:00
|
|
|
|
2022-09-01 20:17:23 -06:00
|
|
|
if [ "$MIME" = "text/html" ]
|
|
|
|
then
|
|
|
|
$BROWSER $1
|
2022-09-03 19:40:16 -06:00
|
|
|
|
2022-09-01 20:17:23 -06:00
|
|
|
else
|
|
|
|
handlr launch "$MIME" -- "$1"
|
|
|
|
fi
|