1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00
dotfiles/urlview/bin/linkhandler.sh
2018-12-16 20:10:29 +01:00

21 lines
566 B
Bash
Executable File

#!/bin/sh
# List of sites that will be opened in mpv.
vidsites="youtube.com"
ext="${1##*.}"
mpvFiles="mkv mp4 gif webm mp3 flac"
fehFiles="png jpg jpeg jpe"
wgetFiles="iso"
if echo $fehFiles | grep -w $ext > /dev/null; then
feh "$1" >/dev/null & disown
elif echo $mpvFiles | grep -w $ext > /dev/null; then
mpv -quiet "$1" > /dev/null & disown
elif echo $wgetFiles | grep -w $ext > /dev/null; then
wget "$1" >/dev/null & disown
elif echo "$@" | grep "$vidsites">/dev/null; then
mpv -quiet "$1" > /dev/null & disown
else
firefox "$1" 2>/dev/null & disown
fi