summary refs log tree commit diff
path: root/home/.local/bin/open
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xhome/.local/bin/open18
1 files changed, 18 insertions, 0 deletions
diff --git a/home/.local/bin/open b/home/.local/bin/open
new file mode 100755
index 00000000..cc13d0a6
--- /dev/null
+++ b/home/.local/bin/open
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -eu
+
+if [ -n "${SSH_CLIENT:-}" ]; then
+	exec pbd -o "$@"
+fi
+
+case "$1" in
+	(*.gif|*.jpeg|*.jpg|*.png)
+		curl -LSs "$1" | imv -
+		;;
+	(https://youtu.be/*|https://www.youtube.com/watch*|https://twitch.tv/*)
+		exec mpv "$1" >/dev/null 2>&1
+		;;
+	(*)
+		exec firefox -new-tab "$1" >/dev/null 2>&1
+		;;
+esac