commit eca22defe25747e226610901d5ab5f4d07bbbc26
parent 42f03cee3df1987abe16958eb9520c6c9b0a27d4
Author: efe <efe@efe.kim>
Date: Wed, 23 Jan 2019 19:00:48 -0500
st/patches: improve example shell script for externalpipe
Diffstat:
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/st.suckless.org/patches/externalpipe/editscreen.sh b/st.suckless.org/patches/externalpipe/editscreen.sh
@@ -1,8 +1,5 @@
#!/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"
+trap 'rm "$tmpfile"' 0 1 15
+cat > "$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
@@ -25,7 +25,7 @@ dmenu to select and open one:
* [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
+* [edit screen](editscreen.sh) - open screen in `$EDITOR` for copying text
Download
--------
diff --git a/st.suckless.org/patches/externalpipe/linkgrabber.sh b/st.suckless.org/patches/externalpipe/linkgrabber.sh
@@ -1,7 +1,4 @@
#!/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"