remove old trash, use spmenu
This commit is contained in:
parent
4155c54d23
commit
3dfd694642
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
## st
|
||||||
|
|
||||||
|
My build of st
|
||||||
|
|
||||||
|
NOTE: Scripts (by default) require [spmenu](https://codeberg.org/speedie/spmenu)
|
||||||
|
|
||||||
|
TODO: Write decent documentation for this.
|
|
@ -2,6 +2,8 @@
|
||||||
# externalpipe_buffer.sh: use with surf/st externalpipe-signal patches
|
# externalpipe_buffer.sh: use with surf/st externalpipe-signal patches
|
||||||
# Input Usage: echo st or surf content from externalpipe | ./externalpipe_buffer.sh {st,surf}_strings_read
|
# Input Usage: echo st or surf content from externalpipe | ./externalpipe_buffer.sh {st,surf}_strings_read
|
||||||
# Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type}
|
# Menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type}
|
||||||
|
|
||||||
|
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER=spmenu
|
||||||
BUFFER_FILE=/tmp/content_buffer
|
BUFFER_FILE=/tmp/content_buffer
|
||||||
function st_strings_read() {
|
function st_strings_read() {
|
||||||
INPUT="$(cat)"
|
INPUT="$(cat)"
|
||||||
|
@ -33,11 +35,11 @@ function trigger_sigusr1() {
|
||||||
}
|
}
|
||||||
function dmenu_copy() {
|
function dmenu_copy() {
|
||||||
trigger_sigusr1
|
trigger_sigusr1
|
||||||
cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Copy' | sed 's/↵/\n/g' | xclip -i
|
cat $BUFFER_FILE | $RUNLAUNCHER -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Copy' | sed 's/↵/\n/g' | xclip -i
|
||||||
}
|
}
|
||||||
function dmenu_type() {
|
function dmenu_type() {
|
||||||
trigger_sigusr1
|
trigger_sigusr1
|
||||||
cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Type' | sed 's/↵/\n/g' | xargs -IC xdotool type --delay 0 "C"
|
cat $BUFFER_FILE | $RUNLAUNCHER -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Type' | sed 's/↵/\n/g' | xargs -IC xdotool type --delay 0 "C"
|
||||||
}
|
}
|
||||||
function pipe_combine() {
|
function pipe_combine() {
|
||||||
trigger_sigusr1
|
trigger_sigusr1
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# original script by Jaywalker and Luke Smith (https://github.com/Lukesmithxyz/st)
|
# original script by Jaywalker and Luke Smith (https://github.com/Lukesmithxyz/st)
|
||||||
|
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER=spmenu
|
||||||
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
|
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
|
||||||
trap 'rm -f "$tmpfile"' 0 1 15
|
trap 'rm -f "$tmpfile"' 0 1 15
|
||||||
sed -n "w $tmpfile"
|
sed -n "w $tmpfile"
|
||||||
sed -i 's/\x0//g' "$tmpfile"
|
sed -i 's/\x0//g' "$tmpfile"
|
||||||
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)"
|
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)"
|
||||||
chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 -w $WINDOWID -g 1 | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | $RUNLAUNCHER -p "Copy which command's output?" -na -i -l 10 -w $WINDOWID -g 1 | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
||||||
eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
||||||
awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard
|
awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
# https://codeberg.org/speedie/speedwm-extras
|
# https://codeberg.org/speedie/speedwm-extras
|
||||||
# Script licensed under GNU GPLv3
|
# Script licensed under GNU GPLv3
|
||||||
|
|
||||||
|
[ -z "$RUNLAUNCHER" ] && RUNLAUNCHER=spmenu
|
||||||
|
|
||||||
EMOJILIST()
|
EMOJILIST()
|
||||||
{
|
{
|
||||||
printf "\
|
printf "\
|
||||||
|
@ -1656,6 +1658,6 @@ printf "\
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
EMOJISEL="$(printf "%s" "$(EMOJILIST)" | dmenu -l 5 -w $WINDOWID -p 'Pick an emoji: ' | awk '{ print $1 }')"
|
EMOJISEL="$(printf "%s" "$(EMOJILIST)" | $RUNLAUNCHER -l 5 -na -w $WINDOWID -p 'Pick an emoji: ' | awk '{ print $1 }')"
|
||||||
[ -z "$EMOJISEL" ] && exit
|
[ -z "$EMOJISEL" ] && exit
|
||||||
printf "%s" "$EMOJISEL" | xclip -selection clipboard && notify-send "$EMOJISEL copied to clipboard."
|
printf "%s" "$EMOJISEL" | xclip -selection clipboard && notify-send "$EMOJISEL copied to clipboard."
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# input Usage: echo st or surf content from externalpipe | ./externalpipe_buffer.sh {st,surf}_strings_read
|
|
||||||
# menus Usage: ./externalpipe_buffer.sh dmenu_{copy, type}
|
|
||||||
command -v xdotool > /dev/null || exit
|
|
||||||
BUFFER_FILE=/tmp/content_buffer
|
|
||||||
function st_strings_read() {
|
|
||||||
INPUT="$(cat)"
|
|
||||||
echo "$(
|
|
||||||
echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]'
|
|
||||||
echo "$INPUT" | grep -oP '"[^"]+"' | tr -d '"'
|
|
||||||
echo "$INPUT" | sed 's/^ *[0-9]\+.//g' | awk '{$1=$1};1'
|
|
||||||
)" | uniq | grep . | awk '{ print length, $0 }' | sort -n -s | cut -d" " -f2- \
|
|
||||||
>> $BUFFER_FILE &
|
|
||||||
}
|
|
||||||
function surf_strings_read() {
|
|
||||||
awk '{printf "%sNEWLINE_REPLACE", $0} END {printf "\n"}' |
|
|
||||||
xmllint --html --xpath "//*" - |
|
|
||||||
awk '{ gsub("<[^>]*>", ""); print($0); }' |
|
|
||||||
sed 's/NEWLINE_REPLACE/↵/g' |
|
|
||||||
awk '{ gsub("<[^>]*>",""); print $0 }' |
|
|
||||||
sed 's/</</g' |
|
|
||||||
sed 's/>/>/g' |
|
|
||||||
uniq | grep . | awk '{ print length, $0 }' | sort -n -s | cut -d" " -f2- \
|
|
||||||
>> $BUFFER_FILE &
|
|
||||||
}
|
|
||||||
function trigger_sigusr1() {
|
|
||||||
USE_FIFO=F # Recomended as T but only if using dmenu-stdin patch w/ FIFO
|
|
||||||
rm -f $BUFFER_FILE
|
|
||||||
if [ $USE_FIFO == T ]; then mkfifo $BUFFER_FILE; else touch $BUFFER_FILE; fi
|
|
||||||
pkill -USR1 "surf" &
|
|
||||||
pkill -USR1 "^st$" &
|
|
||||||
if [ $USE_FIFO != T ]; then sleep 0.8; fi
|
|
||||||
}
|
|
||||||
function dmenu_copy() {
|
|
||||||
trigger_sigusr1
|
|
||||||
cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Copy' | sed 's/↵/\n/g' | xclip -i
|
|
||||||
}
|
|
||||||
function dmenu_type() {
|
|
||||||
trigger_sigusr1
|
|
||||||
cat $BUFFER_FILE | dmenu -l 10 -i -w $(xdotool getactivewindow) -p 'Screen Type' | sed 's/↵/\n/g' | xargs -IC xdotool type --delay 0 "C"
|
|
||||||
}
|
|
||||||
function pipe_combine() {
|
|
||||||
trigger_sigusr1
|
|
||||||
cat - $BUFFER_FILE
|
|
||||||
}
|
|
||||||
|
|
||||||
$1
|
|
Loading…
Reference in a new issue