Updated clipboard script to actually work. Kind of

There are some issues around escaping characters. But it is currently functioning.
This commit is contained in:
James Patrick 2020-09-16 22:09:35 -04:00
parent 50ef9fd177
commit 23d3efc525

View File

@ -65,7 +65,12 @@ on-select(){
if [ -z "$result" ]; then if [ -z "$result" ]; then
exit 0 exit 0
fi fi
(cat "$(parse-file "${result}")" || exit 1) | wl-copy echo 1
wl-paste
local file
file="$(parse-file "${result}")"
wl-copy < "$file"
swaymsg exec "ydotool type \"$(wl-paste)\""
} }
menu(){ menu(){
@ -79,7 +84,9 @@ menu(){
--pointer='➜' \ --pointer='➜' \
--color="gutter:0,prompt:4" \ --color="gutter:0,prompt:4" \
--no-multi \ --no-multi \
--preview "$0 preview '{}'" --preview-window=down:3:wrap --ansi \ --preview "$0 preview {}" \
--preview-window=down:3:wrap \
--ansi \
| on-select | on-select
} }
@ -106,12 +113,15 @@ preview(){
return return
fi fi
printf $(bat -l bash --color always -pp "$file") bat -l bash --color always -pp "$file"
} }
case "$1" in case "$1" in
daemon|on-copy|menu|list) daemon|on-copy|menu|list)
$1;; $1
echo 3
wl-paste
;;
lock) lock)
touch "$workdir/.lock" ; echo "locked";; touch "$workdir/.lock" ; echo "locked";;
unlock) unlock)