diff options
-rw-r--r-- | X/xbindkeysrc | 2 | ||||
-rwxr-xr-x | bin/br | 24 | ||||
-rwxr-xr-x | bin/brxs | 3 | ||||
-rwxr-xr-x | bin/xgo | 33 | ||||
-rw-r--r-- | bin/xgoc | 3 | ||||
-rw-r--r-- | man/man1/brxs.1 | 17 | ||||
-rw-r--r-- | man/man1/xgo.1 | 14 | ||||
-rw-r--r-- | man/man1/xgoc.1 | 13 |
8 files changed, 65 insertions, 44 deletions
diff --git a/X/xbindkeysrc b/X/xbindkeysrc index d4c9deaf..ee58eb35 100644 --- a/X/xbindkeysrc +++ b/X/xbindkeysrc @@ -7,7 +7,7 @@ "exec dmenu_run" Mod4 + d -"exec brxs" +"exec xgoc" Mod4 + g "exec gimp" @@ -1,25 +1,3 @@ #!/bin/sh -# Probably launch $BROWSER, but try a few shortcuts first - -# Get the URL and its MIME type -url=$1 -mt=$(urlmt "$url") - -# If the MIME type is an image, load it in feh(1) -case $mt in - image/gif) ;; - image/*) - curl -- "$url" | feh - && exit - ;; -esac - -# If it's a YouTube video without a given start time, load it in mpv(1) -case $url in - *youtube.com/watch*[?\&]t=) ;; - *youtube.com/watch*) - mpv -- "$url" && exit - ;; -esac - -# Otherwise, just ask $BROWSER to handle it +# Just launch $BROWSER with any given arguments exec "$BROWSER" "$@" diff --git a/bin/brxs b/bin/brxs deleted file mode 100755 index 5324885d..00000000 --- a/bin/brxs +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# Run $BROWSER with an URL retrieved from X's PRIMARY select -exec br "$(xsel)" diff --git a/bin/xgo b/bin/xgo new file mode 100755 index 00000000..56bbb0f9 --- /dev/null +++ b/bin/xgo @@ -0,0 +1,33 @@ +#!/bin/sh +# Test and open a clipboard URL with an apt program + +# Check arguments +if [ "$#" -eq 0 ] ; then + printf 2>&1 'xgo: At least one URL required\n' +fi + +# Iterate over the URL arguments +for url ; do ( + + # If it's a YouTube video without a given start time, load it in mpv(1) + case $url in + *youtube.com/watch*[?\&]t=) ;; + *youtube.com/watch*) + mpv -- "$url" && continue + ;; + esac + + # If the MIME type is an image, load it in feh(1) + case $mt in + image/gif) ;; + image/*) + curl -- "$url" | feh - && continue + ;; + esac + + # Get the MIME type data + mt=$(urlmt "$url") + + # Otherwise, just pass it to br(1) + br "$url" +) & done diff --git a/bin/xgoc b/bin/xgoc new file mode 100644 index 00000000..9e4b0929 --- /dev/null +++ b/bin/xgoc @@ -0,0 +1,3 @@ +#!/bin/sh +# Run xgo(1) with the contents of the X clipboard +xgo "$(xsel)" diff --git a/man/man1/brxs.1 b/man/man1/brxs.1 deleted file mode 100644 index fe6adb95..00000000 --- a/man/man1/brxs.1 +++ /dev/null @@ -1,17 +0,0 @@ -.TH BRXS 1 "August 2016" "Manual page for brxs" -.SH NAME -.B brxs -\- launch "$BROWSER" with the contents of the X clipboard as the sole argument -.SH SYNOPSIS -.B brxs -BROWSER=firefox -.B brxs -.SH DESCRIPTION -.B brxs -runs br(1) with the contents of the X selection buffer as retrieved by xsel(1) -as its sole argument. The intent is to have a quick way to fire up the browser -to look at an URL you have in your clipboard. -.SH SEE ALSO -br(1) -.SH AUTHOR -Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/xgo.1 b/man/man1/xgo.1 new file mode 100644 index 00000000..13cbdd37 --- /dev/null +++ b/man/man1/xgo.1 @@ -0,0 +1,14 @@ +.TH XGO 1 "August 2016" "Manual page for xgo" +.SH NAME +.B xgo +\- view the given URL in an appropriate program, falling back on $BROWSER +.SH SYNOPSIS +.B xgo +.SH DESCRIPTION +.B xgo +examines each of its arguments and opens an appropriate program to view it, +falling back on $BROWSER. +.SH SEE ALSO +br(1), xgoc(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/xgoc.1 b/man/man1/xgoc.1 new file mode 100644 index 00000000..a4c23571 --- /dev/null +++ b/man/man1/xgoc.1 @@ -0,0 +1,13 @@ +.TH XGOC 1 "August 2016" "Manual page for xgoc" +.SH NAME +.B xgoc +\- view an URL in the X clipboard in an appropriate program +.SH SYNOPSIS +.B xgoc +.SH DESCRIPTION +.B xgoc +reads an URL from the X clipboard with xsel(1) and runs xgo(1) on it. +.SH SEE ALSO +br(1), xgoc(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |