[wiki] [sites] Fix a few minor bugs and add info in comments to externalpipe_buffer.sh script || Miles Alan

From: <git_AT_suckless.org>
Date: Mon, 12 Aug 2019 05:42:51 +0200

commit 173c58bffc78e64227b0976a66d766642fea3cb0
Author: Miles Alan <m_AT_milesalan.com>
Date: Sun Aug 11 22:42:03 2019 -0500

    Fix a few minor bugs and add info in comments to externalpipe_buffer.sh script

diff --git a/st.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh b/st.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
index 3cb0175a..d16c1667 100755
--- a/st.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
+++ b/st.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
_AT_@ -5,14 +5,17 @@
 # Script enabling keyboard-based dmenu copy/paste between multiple different
 # st/surf instances. Designed to be used in combination with the surf & st
 # externalpipe-signal patches.
-
+#
+# Note: by default assumes you've patched both st & surf for SIGUSR1 with
+# signal patches and shares 1 buffer for convience. Comment if using just st or surf.
+#
 # Upon executing dmenu_copy/dmenu_type, SIGUSR1 is sent to st & surf.
 # St/surf then additionally call this script w/ "{surf,st}_strings_read" arg.
 # This loads up the $BUFFER_FILE (FIFO or file) with the contents filtered
 # for what should appear in dmenu. If using (BUFFER_FILE_FIFO=true), dmenu
 # is then immediatedly invoked reading from $BUFFER_FILE as STDIN; if not
 # using a FIFO, BUFFER_FILE_R_DELAY is waited on before reading file / invoking dmenu.
-
+#
 # Highly reccomended for quick feedback: set BUFFER_FILE_FIFO=true & use dmenu
 # non_blocking_stdin patch: tools.suckless.org/dmenu/patches/non_blocking_stdin/
 #
_AT_@ -52,10 +55,10 @@ function trigger_sigusr1_and_read_buffer() {
   cat $BUFFER_FILE
   rm $BUFFER_FILE
 }
-function dm() { dmenu "$_AT_" -l 10 -i -w $(xdotool getactivewindow) | sed 's/↵/ /g'; }
+function dm() { dmenu "$_AT_" -l 10 -i -w $(xdotool getactivewindow); }
 
 function st_strings_read() {
- INPUT=$(cat)
+ INPUT="$(cat)"
   echo "$(
     # General Strings, quoted string, and whole lines
     echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]'
_AT_@ -76,7 +79,7 @@ function surf_strings_read() {
     dedupe_and_sort |
     write_to_buffer
 }
-function dmenu_copy() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Copy' | xclip -i; }
-function dmenu_type() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Type' | xargs xdotool type --delay 0; }
+function dmenu_copy() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Copy' | sed 's/↵/
/g' | xclip -i; }
+function dmenu_type() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Type' | sed 's/↵/
/g' | xargs -IC xdotool type --delay 0 "C"; }
 
 $1
diff --git a/surf.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh b/surf.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
index 3cb0175a..d16c1667 100755
--- a/surf.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
+++ b/surf.suckless.org/patches/externalpipe-signal/externalpipe_buffer.sh
_AT_@ -5,14 +5,17 @@
 # Script enabling keyboard-based dmenu copy/paste between multiple different
 # st/surf instances. Designed to be used in combination with the surf & st
 # externalpipe-signal patches.
-
+#
+# Note: by default assumes you've patched both st & surf for SIGUSR1 with
+# signal patches and shares 1 buffer for convience. Comment if using just st or surf.
+#
 # Upon executing dmenu_copy/dmenu_type, SIGUSR1 is sent to st & surf.
 # St/surf then additionally call this script w/ "{surf,st}_strings_read" arg.
 # This loads up the $BUFFER_FILE (FIFO or file) with the contents filtered
 # for what should appear in dmenu. If using (BUFFER_FILE_FIFO=true), dmenu
 # is then immediatedly invoked reading from $BUFFER_FILE as STDIN; if not
 # using a FIFO, BUFFER_FILE_R_DELAY is waited on before reading file / invoking dmenu.
-
+#
 # Highly reccomended for quick feedback: set BUFFER_FILE_FIFO=true & use dmenu
 # non_blocking_stdin patch: tools.suckless.org/dmenu/patches/non_blocking_stdin/
 #
_AT_@ -52,10 +55,10 @@ function trigger_sigusr1_and_read_buffer() {
   cat $BUFFER_FILE
   rm $BUFFER_FILE
 }
-function dm() { dmenu "$_AT_" -l 10 -i -w $(xdotool getactivewindow) | sed 's/↵/ /g'; }
+function dm() { dmenu "$_AT_" -l 10 -i -w $(xdotool getactivewindow); }
 
 function st_strings_read() {
- INPUT=$(cat)
+ INPUT="$(cat)"
   echo "$(
     # General Strings, quoted string, and whole lines
     echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]'
_AT_@ -76,7 +79,7 @@ function surf_strings_read() {
     dedupe_and_sort |
     write_to_buffer
 }
-function dmenu_copy() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Copy' | xclip -i; }
-function dmenu_type() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Type' | xargs xdotool type --delay 0; }
+function dmenu_copy() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Copy' | sed 's/↵/
/g' | xclip -i; }
+function dmenu_type() { trigger_sigusr1_and_read_buffer | dm -p 'Screen Type' | sed 's/↵/
/g' | xargs -IC xdotool type --delay 0 "C"; }
 
 $1
Received on Mon Aug 12 2019 - 05:42:51 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 12 2019 - 05:48:29 CEST