From 9e3be00851ee670a76ec4ced82f973091a7c9cbd Mon Sep 17 00:00:00 2001 From: Markus Meier Date: Mon, 3 Feb 2025 00:07:05 +0100 Subject: [PATCH 1/2] feat: show errors in x2sel --- plugins/x2sel | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/x2sel b/plugins/x2sel index 95414fc46..a16a25d58 100755 --- a/plugins/x2sel +++ b/plugins/x2sel @@ -52,9 +52,15 @@ getclip () { CLIPBOARD=$(getclip) +if [ -z "$CLIPBOARD" ]; then + echo "No content in clipboard" + exit 1 +fi + # Check if clipboard actually contains a file list for file in $CLIPBOARD ; do if [ ! -e "$file" ] ; then + echo "'$file' is not a file" exit 1; fi done From aae7d399b9449bc30aa8088d5b2191d5f6b73390 Mon Sep 17 00:00:00 2001 From: Markus Meier Date: Tue, 4 Feb 2025 21:03:08 +0100 Subject: [PATCH 2/2] fix: remove carriage return in WSL --- plugins/x2sel | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/x2sel b/plugins/x2sel index a16a25d58..4682e51a4 100755 --- a/plugins/x2sel +++ b/plugins/x2sel @@ -8,7 +8,7 @@ # - pbpaste (macOS) # - termux-clipboard-get (Termux) # - powershell (WSL) -# - cygwim's /dev/clipboard (Cygwin) +# - cygwin's /dev/clipboard (Cygwin) # - wl-paste (Wayland) # - clipboard (Haiku) # @@ -26,6 +26,9 @@ getclip () { if [ "$XDG_SESSION_TYPE" = "wayland" ]; then # Wayland wl-paste + elif type powershell.exe >/dev/null 2>&1; then + # WSL + powershell.exe -noprofile -command Get-Clipboard | tr -d '\r' elif type xsel >/dev/null 2>&1; then # Linux xsel -bo @@ -38,9 +41,6 @@ getclip () { elif type termux-clipboard-get >/dev/null 2>&1; then # Termux termux-clipboard-get - elif type powershell.exe >/dev/null 2>&1; then - # WSL - powershell.exe Get-Clipboard elif [ -r /dev/clipboard ] ; then # Cygwin cat /dev/clipboard