mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
replaced urlview with urlscan
This commit is contained in:
parent
6fb404ca69
commit
a77071a22f
35
urlscan/.scripts/linkhandler.sh
Executable file
35
urlscan/.scripts/linkhandler.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Feed script a url or file location.
|
||||||
|
# If an image, it will view in sxiv,
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Set default browser
|
||||||
|
if [ -e "/usr/bin/firefox" ]
|
||||||
|
then
|
||||||
|
export BROWSER="firefox"
|
||||||
|
elif [ -e "/usr/bin/iceweasel" ]
|
||||||
|
then
|
||||||
|
export BROWSER="iceweasel"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set default terminal
|
||||||
|
export TERMINAL="st"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
||||||
|
setsid mpv --input-ipc-server=/tmp/mpvsoc"$(date +%s)" -quiet "$1" >/dev/null 2>&1 & ;;
|
||||||
|
*png|*jpg|*jpe|*jpeg|*gif)
|
||||||
|
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
|
||||||
|
*mp3|*flac|*opus|*mp3?source*)
|
||||||
|
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
|
||||||
|
*)
|
||||||
|
if [ -f "$1" ];
|
||||||
|
then
|
||||||
|
"$TERMINAL" -e "$EDITOR $1"
|
||||||
|
else
|
||||||
|
setsid "$BROWSER" "$1" >/dev/null 2>&1 &
|
||||||
|
fi ;;
|
||||||
|
esac
|
@ -1,2 +0,0 @@
|
|||||||
REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]
|
|
||||||
COMMAND linkhandler.sh
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# List of sites that will be opened in mpv.
|
|
||||||
vidsites="youtube.com"
|
|
||||||
ext="${1##*.}"
|
|
||||||
mpvFiles="mkv mp4 gif webm mp3 flac"
|
|
||||||
fehFiles="png jpg jpeg jpe"
|
|
||||||
wgetFiles="iso"
|
|
||||||
|
|
||||||
if echo $fehFiles | grep -w $ext > /dev/null; then
|
|
||||||
feh "$1" >/dev/null & disown
|
|
||||||
elif echo $mpvFiles | grep -w $ext > /dev/null; then
|
|
||||||
mpv -quiet "$1" > /dev/null & disown
|
|
||||||
elif echo $wgetFiles | grep -w $ext > /dev/null; then
|
|
||||||
wget "$1" >/dev/null & disown
|
|
||||||
elif echo "$@" | grep "$vidsites">/dev/null; then
|
|
||||||
mpv -quiet "$1" > /dev/null & disown
|
|
||||||
else
|
|
||||||
firefox "$1" 2>/dev/null & disown
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user