blob: 392f1375e1dd5ba41fac89056625b877a8845583 (
plain) (
tree)
|
|
#!/bin/sh
note()
{
command -v notify-send > /dev/null &&
notify-send " linkhandler" "$1"
}
main()
{
[ -z "$1" ] &&
exec "${BROWSER:-firefox}"
case "${1%/}" in
*mp3|*flac|*opus|*mkv|*webm|*mp4|*youtube.com/watch*|\
*youtube.com/playlist*|*youtu.be*|*bitchute.com*|*videos.lukesmith.xyz*|\
*piped.kavin.rocks*|*inv.vern.cc*|*yewtu.be*)
note "streaming media"
exec mpv -quiet "$1" > /dev/null 2>&1
;;
*.png|*.jpg|*.jpeg|*.gif|*.webp|*.pdf|*.cbz|*.cbr)
note "processing file"
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" &&
exec xdg-open "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" > /dev/null 2>&1 &
;;
*.cpp|*.c|*.sh|*.txt)
note "processing text"
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" &&
exec "$TERMINAL" -e xdg-open "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" > /dev/null 2>&1 &
;;
*.onion)
exec tor-browser "$1" >/dev/null 2>&1
;;
*)
exec "$BROWSER" "$1" >/dev/null 2>&1
;;
esac
}
main "$@"
|