diff options
| author | Anton Bobov <anton@bobov.name> | 2026-08-20 15:13:47 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2026-08-20 15:13:47 +0500 |
| commit | 153c9344e93662984b1a5368a2722c10117db830 (patch) | |
| tree | 46b44af16387c815ab6c783415ee7dc1b8287a5c /files/.config/nnn/plugins/x2sel | |
| parent | ccbc3e18f711c39482e9ed6045ed99b4da889a59 (diff) | |
nnn: update plugins
Diffstat (limited to 'files/.config/nnn/plugins/x2sel')
| -rwxr-xr-x | files/.config/nnn/plugins/x2sel | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/files/.config/nnn/plugins/x2sel b/files/.config/nnn/plugins/x2sel index 95414fc..4682e51 100755 --- a/files/.config/nnn/plugins/x2sel +++ b/files/.config/nnn/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 |
