[wiki] [sites] st/patches: improve example shell script for externalpipe || efe
commit eca22defe25747e226610901d5ab5f4d07bbbc26
Author: efe <efe_AT_efe.kim>
Date: Wed Jan 23 19:00:48 2019 -0500
st/patches: improve example shell script for externalpipe
diff --git a/st.suckless.org/patches/externalpipe/editscreen.sh b/st.suckless.org/patches/externalpipe/editscreen.sh
index 3b1c5f8b..33266668 100755
--- a/st.suckless.org/patches/externalpipe/editscreen.sh
+++ b/st.suckless.org/patches/externalpipe/editscreen.sh
_AT_@ -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
index 86f43c10..c5e79625 100644
--- a/st.suckless.org/patches/externalpipe/index.md
+++ b/st.suckless.org/patches/externalpipe/index.md
_AT_@ -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
index 736b77c7..90e3fb09 100755
--- a/st.suckless.org/patches/externalpipe/linkgrabber.sh
+++ b/st.suckless.org/patches/externalpipe/linkgrabber.sh
_AT_@ -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)[.:][^ >" ]*|www\.[-a-z0-9.]+)[^ .,; >">\):]'
url=$(grep -Po "$regex" | dmenu -p "Go:" -w "$WINDOWID") || exit
$BROWSER "$url"
Received on Thu Jan 24 2019 - 01:03:43 CET
This archive was generated by hypermail 2.3.0
: Thu Jan 24 2019 - 01:12:26 CET