commit d7004fe6e303931758a225f9c436929ee4a529d5
parent 40d1eb80ac0d9e8b98b37ecf304beed593667d6d
Author: efe <efe@efe.kim>
Date: Wed, 5 Dec 2018 10:26:30 -0500
st/patches/externalpipe: add usefull shell scripts
Diffstat:
3 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/st.suckless.org/patches/externalpipe/editscreen.sh b/st.suckless.org/patches/externalpipe/editscreen.sh
@@ -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
@@ -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
@@ -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)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]'
+url=$(grep -Po "$regex" | dmenu -p "Go:" -w "$WINDOWID") || exit
+$BROWSER "$url"