diff --git a/sway/scripts/clipboard b/sway/scripts/clipboard index 9cc57f3..e25c9cc 100755 --- a/sway/scripts/clipboard +++ b/sway/scripts/clipboard @@ -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)