nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit af9bfd370faa90966cc75a93feceec7cb5bb2321
parent 9a128f133f2f4191b4ab1458edc93a363436d188
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Wed,  5 Feb 2025 18:17:14 +0530

Merge pull request #1994 from psicho2000/fix/paste-from-wsl

fix/paste from wsl
Diffstat:
Mplugins/x2sel | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 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 @@ -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