diff options
| author | ProsperousPotato <ProsperousPotato@users.noreply.github.com> | 2026-01-22 21:36:00 +0000 |
|---|---|---|
| committer | ProsperousPotato <ProsperousPotato@users.noreply.github.com> | 2026-01-22 21:36:00 +0000 |
| commit | 5d51b613de66ab2eb312ca4184b8f84e51ecb1fb (patch) | |
| tree | 43da1385e65c8cd7579384cbe0f72e1fcd26f162 /st-copyout | |
| parent | 33674943e8205d2a08edec4670332350e728124a (diff) | |
add url bindings
Diffstat (limited to 'st-copyout')
| -rwxr-xr-x | st-copyout | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/st-copyout b/st-copyout new file mode 100755 index 0000000..6f5a182 --- /dev/null +++ b/st-copyout @@ -0,0 +1,15 @@ +#!/bin/sh +# Using external pipe with st, give a dmenu prompt of recent commands, +# allowing the user to copy the output of one. +# xclip required for this script. +# By Jaywalker and Luke +# https://github.com/LukeSmithxyz/st + +tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX) +trap 'rm "$tmpfile"' 0 1 15 +sed -n "w $tmpfile" +sed -i 's/\x0//g' "$tmpfile" +ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)" +chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -vi -p "Copy which command's output?" -i -l 10 | 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 |
