summaryrefslogtreecommitdiffstats
path: root/.scripts/webview
blob: 17462fc3671ceb042dcb1dc63712fc1b89664ee6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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