summaryrefslogtreecommitdiffstats
path: root/.scripts
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-03-09 15:47:03 -0700
committerLuke Smith <luke@lukesmith.xyz>2018-03-09 15:47:03 -0700
commit0ce19eaeabbc23d47625757da4d14690fbafd49f (patch)
tree6d6f6502053a579e0fdf9ac0ad2b4cf3f221b60c /.scripts
parente8f2d08a8e87fe8b079c256c2fb9464221ec6fcc (diff)
downloadeibhear-0ce19eaeabbc23d47625757da4d14690fbafd49f.tar.gz
eibhear-0ce19eaeabbc23d47625757da4d14690fbafd49f.tar.zst
eibhear-0ce19eaeabbc23d47625757da4d14690fbafd49f.zip
webview update
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/webview24
1 files changed, 15 insertions, 9 deletions
diff --git a/.scripts/webview b/.scripts/webview
index 17462fc..3f80998 100755
--- a/.scripts/webview
+++ b/.scripts/webview
@@ -1,23 +1,29 @@
#!/bin/bash
# Feed script a url.
-# Opens the url with xdg-open unless it is an image,
-# in which case it downloads in feh.
+# If an image, it will view in feh,
+# if a video or gif, it will view in mpv
+# if a music file or pdf, it will download,
+# otherwise it opens link in browser.
+
+# List of sites that will be opened in mpv.
+vidsites="youtube.com
+ \|hooktube.com
+ \|bitchute.com
+ "
+detectVidSite() { (echo "$1" | grep "$vidsites">/dev/null) && mpv -quiet $1 > /dev/null & }
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
+ feh "$1" >/dev/null &
elif echo $mpvFiles | grep -w $ext > /dev/null; then
- nohup mpv --loop --quiet "$1" > /dev/null &
+ mpv --loop --quiet "$1" > /dev/null &
elif echo $wgetFiles | grep -w $ext > /dev/null; then
- nohup wget "$1" >/dev/null &
+ wget "$1" >/dev/null &
else
- nohup $BROWSER "$1" >/dev/null &
+ detectVidSite "$1"
fi