aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/xdg-open
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2023-10-19 20:27:21 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2023-10-19 20:27:21 +0000
commit4df2b9df655ac792058611e3d8a27ffdfdc1c846 (patch)
tree5959e65a6c493a0286c33b73423b533e586b72f5 /.local/bin/xdg-open
parenteeee4128e71b17a59efc93b76d264b7a25cead44 (diff)
downloaddotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar.gz
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar.bz2
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar.lz
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar.xz
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.tar.zst
dotfiles-4df2b9df655ac792058611e3d8a27ffdfdc1c846.zip
Add sanitization and xdg-open helper script
Diffstat (limited to '')
-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
+