aboutsummaryrefslogtreecommitdiffstats
path: root/st-cpycmd
diff options
context:
space:
mode:
authorjoe <rbo@gmx.us>2025-10-08 14:27:12 +0200
committerjoe <rbo@gmx.us>2025-10-08 14:27:12 +0200
commit8a2f35d27ae999c0bd0f961189929bf5f9e56713 (patch)
treeb3a042641c0efbbe6403019ecb8eb88e4201f36c /st-cpycmd
parentclipcmd (diff)
downloadst-8a2f35d27ae999c0bd0f961189929bf5f9e56713.tar.gz
st-8a2f35d27ae999c0bd0f961189929bf5f9e56713.tar.bz2
st-8a2f35d27ae999c0bd0f961189929bf5f9e56713.tar.xz
st-8a2f35d27ae999c0bd0f961189929bf5f9e56713.tar.zst
st-8a2f35d27ae999c0bd0f961189929bf5f9e56713.zip
nice
Diffstat (limited to 'st-cpycmd')
-rwxr-xr-xst-cpycmd10
1 files changed, 7 insertions, 3 deletions
diff --git a/st-cpycmd b/st-cpycmd
index ece0c21..3fb38c4 100755
--- a/st-cpycmd
+++ b/st-cpycmd
@@ -5,7 +5,7 @@
# xclip required for this script.
# By joe, adapted from st-cpyout by Jaywalker and Luke
-mem=$(sed 's/^ $//g' | sed 's/\x0//g')
+mem=$(sed '{s/^ $//g;s/\x0//g;}')
ps1=$(printf "%s" "$mem" |
tail -n1 |
sed -E 's/([%,#,>,$]).*/\1/')
@@ -15,7 +15,11 @@ chosen=$(printf "%s" "$mem" |
tac |
dmenu -i -l 10 -m 0)
if [ -n "$chosen" ]; then
- cmd=$(printf "%s" "$chosen" | sed "s/^$ps1 //")
+ cmd=$(printf "%s" "$chosen" | sed "{s/^$ps1 //;s/ $//;}")
printf "%s" "$cmd" | xclip -selection clipboard
- herbe " clipped : $(printf "%.10s..." "$cmd")" &
+ herbe=$(printf " clipped cmd : %.10s" "$cmd")
+ if [ "$(printf "%s" "$cmd" | wc -c)" -gt 10 ]; then
+ herbe="${herbe}..."
+ fi
+ herbe "$herbe" &
fi