#!/bin/sh echo "Loading extensions..." INPUT=$(echo $1) for EXT in /etc/xdg-sanity/extensions/*.sh do echo "Found extension $EXT" TYPE=$(cat $EXT | sed -ne 's/^# EXT-TYPE=//p' | tr -d '\n') echo "Modifying $INPUT..." if [ "$TYPE" = "pre" ] then MOD=$($EXT "$INPUT") INPUT=$(echo $MOD) fi echo "Got $INPUT" done echo "Determining MIME type of $INPUT:" MIME=$(curl -I -s "$INPUT" | sed -ne 's/^[cC]ontent-[tT]ype: //p' | sed -e 's/;.\+//g' | tr -d '\r') echo $MIME BROWSER=$(cat /etc/xdg-sanity.conf | sed -ne 's/^browser = //p' ) if [ "$MIME" = "text/html" ] then $BROWSER $INPUT else handlr launch "$MIME" -- "$INPUT" fi