commit: 0a6a286b3bd04e473d17a966391a092921ad0e63
parent b9730b5215879674d34a01f81bb20c0da4093552
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 22 Aug 2021 18:56:37 +0200
.local/bin/xdg-open: Add
Diffstat:
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Never exits 0 because xdg-open likes trial-and-error
+
+unsupported() {
+ echo "Unsupported target"
+ exit 0
+}
+
+case "$@" in
+ 'magnet:'*|*'.torrent')
+ unsupported
+ ;;
+ *'youtube.com/'*|*'.mkv'|*'.mp4'|*'.webm'|*'.avi'|*.'.ogg'|*.'.mp3')
+ mpv "$@"
+ ;;
+ 'https://'*|'http://'*|*'.html')
+ badwolf "$@"
+ ;;
+ *'.pdf'|*'.epub'|*'.mobi')
+ evince "$@"
+ ;;
+ *'.png'|*'.jpg'|*'.jpeg'|*'.webp')
+ imv "$@"
+ ;;
+ *)
+ echo "I do not know what to do here"
+ exit 0
+ ;;
+esac