xdg-sanity/xdg-sanity.sh

16 lines
312 B
Bash
Executable File

#!/bin/sh
echo "Determining MIME type of $1:"
MIME=$(curl -I -s "$1" | sed -n -e 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r')
echo $MIME
BROWSER=$(cat /etc/xdg-sanity.conf | sed -n -e 's/^browser = //p' )
if [ "$MIME" = "text/html" ]
then
$BROWSER $1
else
handlr launch "$MIME" -- "$1"
fi