aboutsummaryrefslogtreecommitdiff
path: root/bin/xgo.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-01-01 01:11:08 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-01-01 01:11:08 +1300
commite19bb8fb3c8350bee288327abd978a59eb3dc0f7 (patch)
tree754d2d883b27477f53f0fece44ef9edc7e4238f0 /bin/xgo.sh
parentMerge branch 'release/v4.2.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-4.3.0.tar.gz (sig)
dotfiles-4.3.0.zip
Merge branch 'release/v4.3.0'v4.3.0
* release/v4.3.0: Bump VERSION Switch to using GNU Emacs on development machines Trim some trailing whitespace Clarify control flow in shell scripts Add clarifying comment Translate a short-circuit into a conditional Add a cheeky error message to sd() Strip trailing slashes from sd() target Correct error message from sd()
Diffstat (limited to 'bin/xgo.sh')
-rw-r--r--bin/xgo.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/bin/xgo.sh b/bin/xgo.sh
index 1b9f83da..6d6586ef 100644
--- a/bin/xgo.sh
+++ b/bin/xgo.sh
@@ -15,7 +15,8 @@ for url do (
# If this is a GitHub or GitLab link, swap "blob" for "raw" to get the
# actual file
(*://github.com/*/blob/*|*://gitlab.com/*/blob/*)
- url=$(printf '%s\n' "$url" | sed 's_/blob/_/raw/_')
+ url=$(printf '%s\n' "$url" |
+ sed 's_/blob/_/raw/_')
;;
# Dig out the plain text for pastebin.com links
@@ -38,7 +39,7 @@ for url do (
# mpv(1)
(*[/.]youtube.com/watch*[?\&]t=) ;;
(*[/.]youtube.com/watch*)
- mpv -- "$url" && exit
+ exec mpv -- "$url"
;;
esac
@@ -54,30 +55,32 @@ for url do (
(
cd -- "$HOME"/Downloads || exit
curl -O -- "$url" || exit
- xpdf -- "${url##*/}"
- ) && exit
+ exec xpdf -- "${url##*/}"
+ )
;;
# Open audio and video in mpv(1); force a window even for audio so I
# can control it
(audio/*|video/*)
- mpv --force-window -- "$url" && exit
+ exec mpv --force-window -- "$url"
;;
# If the MIME type is an image that is not a GIF, load it in feh(1)
(image/gif) ;;
(image/*)
- curl -- "$url" | feh - && exit
+ exec curl -- "$url" | feh -
;;
# Open plain text in a terminal view(1)
(text/plain)
# shellcheck disable=SC2016
- urxvt -e sh -c 'curl -- "$1" | view -' _ "$url" && exit
+ exec urxvt -e sh -c 'curl -- "$1" | view -' _ "$url"
;;
- esac
- # Otherwise, just pass it to br(1df)
- br "$url"
+ # Otherwise, just pass it to br(1df)
+ (*)
+ exec br "$url"
+ ;;
+ esac
) & done