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
1 changed files with 20 additions and 10 deletions

View File

@ -65,7 +65,12 @@ on-select(){
if [ -z "$result" ]; then
exit 0
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(){
@ -74,13 +79,15 @@ menu(){
--info=hidden \
--reverse \
-d "${delim}" --nth ..2 --with-nth 2 \
--bind="del:execute()" \
--prompt='clip:: ' \
--pointer='➜' \
--color="gutter:0,prompt:4" \
--no-multi \
--preview "$0 preview '{}'" --preview-window=down:3:wrap --ansi \
| on-select
--bind="del:execute()" \
--prompt='clip:: ' \
--pointer='➜' \
--color="gutter:0,prompt:4" \
--no-multi \
--preview "$0 preview {}" \
--preview-window=down:3:wrap \
--ansi \
| on-select
}
usage(){
@ -106,12 +113,15 @@ preview(){
return
fi
printf $(bat -l bash --color always -pp "$file")
bat -l bash --color always -pp "$file"
}
case "$1" in
daemon|on-copy|menu|list)
$1;;
$1
echo 3
wl-paste
;;
lock)
touch "$workdir/.lock" ; echo "locked";;
unlock)