Introduction
Introduction Statistics Contact Development Disclaimer Help
externalpipe_buffer.sh - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
externalpipe_buffer.sh (1735B)
---
1 #!/usr/bin/env sh
2 # externalpipe_buffer.sh: use with surf/st externalpipe-signal patches
3 # Input Usage: echo st or surf content from externalpipe | ./externalp…
4 # Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type}
5 BUFFER_FILE=/tmp/content_buffer
6 function st_strings_read() {
7 INPUT="$(cat)"
8 echo "$(
9 echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]'
10 echo "$INPUT" | grep -oP '"[^"]+"' | tr -d '"'
11 echo "$INPUT" | sed 's/^ *[0-9]\+.//g' | awk '{$1=$1};1'
12 )" | uniq | grep . | awk '{ print length, $0 }' | sort -n -s | cut -d"…
13 >> $BUFFER_FILE &
14 }
15 function surf_strings_read() {
16 awk '{printf "%sNEWLINE_REPLACE", $0} END {printf "\n"}' |
17 xmllint --html --xpath "//*" - |
18 awk '{ gsub("<[^>]*>", ""); print($0); }' |
19 sed 's/NEWLINE_REPLACE/↵/g' |
20 awk '{ gsub("<[^>]*>",""); print $0 }' |
21 sed 's/&lt;/</g' |
22 sed 's/&gt;/>/g' |
23 uniq | grep . | awk '{ print length, $0 }' | sort -n -s | cut -d" " …
24 >> $BUFFER_FILE &
25 }
26 function trigger_sigusr1() {
27 USE_FIFO=F # Recomended as T but only if using dmenu-stdin patch w/ FI…
28 rm -f $BUFFER_FILE
29 if [ $USE_FIFO == T ]; then mkfifo $BUFFER_FILE; else touch $BUFFER_FI…
30 pkill -USR1 "surf" &
31 pkill -USR1 "^st$" &
32 if [ $USE_FIFO != T ]; then sleep 0.8; fi
33 }
34 function dmenu_copy() {
35 trigger_sigusr1
36 cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Sc…
37 }
38 function dmenu_type() {
39 trigger_sigusr1
40 cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Sc…
41 }
42 function pipe_combine() {
43 trigger_sigusr1
44 cat - $BUFFER_FILE
45 }
46
47 $1
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.