aboutsummaryrefslogtreecommitdiff
path: root/bin/br
blob: d092eb6bedaa1c0df41d0b9780b841a9ca911410 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Probably launch $BROWSER, but try a few shortcuts first

# Get the URL and its MIME type
url=$1
mt=$(urlmt "$url")

# If the MIME type is an image, load it in feh(1)
case $mt in
    image/gif) ;;
    image/*)
        curl -- "$url" | feh - && exit
        ;;
esac

# If it's a YouTube video without a given start time, load it in mpv(1)
case $url in
    *youtube.com/watch*[?\&]t=) ;;
    *youtube.com/watch*)
        mpv -- "$url" && exit
        ;;
esac

# Otherwise, just ask $BROWSER to handle it
exec "$BROWSER" "$@"