From 7342d94520a3b63de17695c9b9add36fa66533f3 Mon Sep 17 00:00:00 2001 From: luxick Date: Mon, 16 Mar 2026 10:27:10 +0100 Subject: [PATCH] update copy/pase for wayland --- bin/copy | 36 +++++++++++++++++++++++++----------- bin/pasta | 2 ++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/bin/copy b/bin/copy index fde9f51..fd09c9d 100755 --- a/bin/copy +++ b/bin/copy @@ -2,17 +2,31 @@ set -e set -u -if hash pbcopy 2>/dev/null; then - exec pbcopy -elif hash xclip 2>/dev/null; then - exec xclip -selection clipboard -elif hash putclip 2>/dev/null; then - exec putclip +if [ $# -eq 0 ]; then + if hash pbcopy 2>/dev/null; then + exec pbcopy + elif hash wl-copy 2>/dev/null; then + exec wl-copy + elif hash xclip 2>/dev/null; then + exec xclip -selection clipboard + elif hash putclip 2>/dev/null; then + exec putclip + fi else - rm -f /tmp/clipboard 2> /dev/null - if [ $# -eq 0 ]; then - cat > /tmp/clipboard - else - cat "$1" > /tmp/clipboard + if hash pbcopy 2>/dev/null; then + exec pbcopy < "$1" + elif hash wl-copy 2>/dev/null; then + exec wl-copy < "$1" + elif hash xclip 2>/dev/null; then + exec xclip -selection clipboard < "$1" + elif hash putclip 2>/dev/null; then + exec putclip < "$1" fi fi + +rm -f /tmp/clipboard 2> /dev/null +if [ $# -eq 0 ]; then + cat > /tmp/clipboard +else + cat "$1" > /tmp/clipboard +fi diff --git a/bin/pasta b/bin/pasta index d04e0a3..9fdfac1 100755 --- a/bin/pasta +++ b/bin/pasta @@ -4,6 +4,8 @@ set -u if hash pbpaste 2>/dev/null; then exec pbpaste +elif hash wl-paste 2>/dev/null; then + exec wl-paste elif hash xclip 2>/dev/null; then exec xclip -selection clipboard -o elif [[ -e /tmp/clipboard ]]; then