aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/xdg-open
blob: 8cb094ec916994ebbd6e2aa5b03c226486f73d8c (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
#!/usr/bin/env sh

URL="$1"
xdgopen="$(which --all xdg-open | tac | head --lines 1)"

if [ "$URL" = "--help" ]
then
	echo "Help here"
	exit 1
fi

term() {
	footclient $@ || alacritty -e $@
}

if echo "$URL" | grep -qE "https?://.*youtu"
then
	mpv "$URL"
else
	$xdgopen "$URL"
	# term w3m "$URL"
fi