aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/xdg-open
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/xdg-open')
-rwxr-xr-x.local/bin/xdg-open23
1 files changed, 23 insertions, 0 deletions
diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open
new file mode 100755
index 0000000..8cb094e
--- /dev/null
+++ b/.local/bin/xdg-open
@@ -0,0 +1,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
+