[wiki] [sites] st/patches/externalpipe: add usefull shell scripts || efe

From: <git_AT_suckless.org>
Date: Wed, 05 Dec 2018 16:34:25 +0100

commit d7004fe6e303931758a225f9c436929ee4a529d5
Author: efe <efe_AT_efe.kim>
Date: Wed Dec 5 10:26:30 2018 -0500

    st/patches/externalpipe: add usefull shell scripts

diff --git a/st.suckless.org/patches/externalpipe/editscreen.sh b/st.suckless.org/patches/externalpipe/editscreen.sh
new file mode 100755
index 00000000..3b1c5f8b
--- /dev/null
+++ b/st.suckless.org/patches/externalpipe/editscreen.sh
_AT_@ -0,0 +1,8 @@
+#!/bin/sh
+# Open screen content in an editor to copy text. This is alternative to
+# keyboard_select st patch. Set $EDITOR to whatever you want.
+
+tmpfile=$(mktemp /tmp/st-edit.XXXXXX)
+sed -n p > "$tmpfile"
+st -e "$EDITOR" "$tmpfile"
+rm "$tmpfile"
diff --git a/st.suckless.org/patches/externalpipe/index.md b/st.suckless.org/patches/externalpipe/index.md
index 671c87f3..42912bbd 100644
--- a/st.suckless.org/patches/externalpipe/index.md
+++ b/st.suckless.org/patches/externalpipe/index.md
_AT_@ -23,6 +23,10 @@ dmenu to select and open one:
 ([xurls](https://raw.github.com/bobrippling/perlbin/master/xurls) and
 [open](https://github.com/bobrippling/open) are external scripts)
 
+### Example Shell Scripts
+
+* [link grabber](linkgrabber.sh) - similar to the function above, but without xurls dependency
+* [edit screen](editscreen.sh) - open screen in an editor for copying text
 
 Download
 --------
diff --git a/st.suckless.org/patches/externalpipe/linkgrabber.sh b/st.suckless.org/patches/externalpipe/linkgrabber.sh
new file mode 100755
index 00000000..736b77c7
--- /dev/null
+++ b/st.suckless.org/patches/externalpipe/linkgrabber.sh
_AT_@ -0,0 +1,7 @@
+#!/bin/sh
+# List the urls on the screen with dmenu and open selection with
+# $BROWSER. This script is alternative to copyurl st patch.
+
+regex='(((http|https|ftp|gopher)|mailto)[.:][^ >" ]*|www\.[-a-z0-9.]+)[^ .,; >">\):]'
+url=$(grep -Po "$regex" | dmenu -p "Go:" -w "$WINDOWID") || exit
+$BROWSER "$url"
Received on Wed Dec 05 2018 - 16:34:25 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 05 2018 - 16:36:28 CET