From 840f1e3bdd34b0b4b8d1d199ef6e97b6f1a1951d Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Fri, 18 Sep 2020 00:13:07 +0300 Subject: Use solely mimeo to handle default files/links --- dotfiles/.local/bin/imgurl | 6 ++++++ dotfiles/.local/bin/linkhandler | 23 ----------------------- dotfiles/.local/bin/menuwebsurf | 7 +++---- 3 files changed, 9 insertions(+), 27 deletions(-) create mode 100755 dotfiles/.local/bin/imgurl delete mode 100755 dotfiles/.local/bin/linkhandler (limited to 'dotfiles/.local/bin') diff --git a/dotfiles/.local/bin/imgurl b/dotfiles/.local/bin/imgurl new file mode 100755 index 0000000..2a2cb37 --- /dev/null +++ b/dotfiles/.local/bin/imgurl @@ -0,0 +1,6 @@ +#!/bin/sh + +[ -z "$1" ] && exit + +setsid curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & + diff --git a/dotfiles/.local/bin/linkhandler b/dotfiles/.local/bin/linkhandler deleted file mode 100755 index 338750d..0000000 --- a/dotfiles/.local/bin/linkhandler +++ /dev/null @@ -1,23 +0,0 @@ -#!/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. - -# If no url given opens browser. -[ -z "$1" ] && { "$BROWSER"; exit; } - -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 & ;; - *://*|*.*) - setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; - *) # If it's not a url, perform a search using duckduckgo - setsid "$BROWSER" "https://duckduckgo.com/?q=$1&t=ffab&atb=v1-1" >/dev/null 2>&1 & ;; -esac diff --git a/dotfiles/.local/bin/menuwebsurf b/dotfiles/.local/bin/menuwebsurf index 00155c6..bef9890 100755 --- a/dotfiles/.local/bin/menuwebsurf +++ b/dotfiles/.local/bin/menuwebsurf @@ -1,7 +1,6 @@ #!/bin/sh -# menu prompt to open a link or search with duckduckgo if it's -# not a url +# menu prompt to open a link with mimeo # Source settings from .bemenurc . ~/.config/bemenurc @@ -16,8 +15,8 @@ fi choice=$(echo "$prompt" | bemenu -i -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 if [ "$choice" = "🌐" ]; then - linkhandler + $BROWSER else - linkhandler "$choice" + mimeo "$choice" fi -- cgit v1.2.3