summaryrefslogtreecommitdiffstats
path: root/.scripts/webview
diff options
context:
space:
mode:
authorLuke <luke@lukesmith.xyz>2018-02-20 14:29:53 -0700
committerLuke <luke@lukesmith.xyz>2018-02-20 14:29:53 -0700
commit838eeec9acdc320bbab24b69db3041e436cdc996 (patch)
treee220c4843b25626a9733ee39cb45fcf1dadc1394 /.scripts/webview
parentf1366ff22b4f6f97b27edecda9ecf434c38ae426 (diff)
downloadeibhear-838eeec9acdc320bbab24b69db3041e436cdc996.tar.gz
eibhear-838eeec9acdc320bbab24b69db3041e436cdc996.tar.zst
eibhear-838eeec9acdc320bbab24b69db3041e436cdc996.zip
scripts folder moved to ~/.scripts
Diffstat (limited to '.scripts/webview')
-rwxr-xr-x.scripts/webview23
1 files changed, 23 insertions, 0 deletions
diff --git a/.scripts/webview b/.scripts/webview
new file mode 100755
index 0000000..17462fc
--- /dev/null
+++ b/.scripts/webview
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Feed script a url.
+# Opens the url with xdg-open unless it is an image,
+# in which case it downloads in feh.
+
+ext="${1##*.}"
+mpvFiles="mkv mp4 gif"
+fehFiles="png jpg jpeg jpe"
+wgetFiles="mp3 flac opus mp3?source=feed pdf"
+
+pgrep i3 ifi3="i3 exec"
+
+if echo $fehFiles | grep -w $ext > /dev/null; then
+ nohup feh "$1" >/dev/null &
+#elif [[ "$ext" == "gif" ]]; then
+elif echo $mpvFiles | grep -w $ext > /dev/null; then
+ nohup mpv --loop --quiet "$1" > /dev/null &
+elif echo $wgetFiles | grep -w $ext > /dev/null; then
+ nohup wget "$1" >/dev/null &
+else
+ nohup $BROWSER "$1" >/dev/null &
+fi