plugins/.cbcp | 8 ++++---- plugins/x2sel | 8 ++++---- diff --git a/plugins/.cbcp b/plugins/.cbcp index 70f9b75c15d11533f983424f6d944b1b0802649f..d2ac944bbc0a82004548686e62d5243968cb8b11 100755 --- a/plugins/.cbcp +++ b/plugins/.cbcp @@ -24,7 +24,10 @@ selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} [ -s "$selection" ] || { echo "plugin .cbcp error: empty selection" >&2 ; exit 1; } -if type xsel >/dev/null 2>&1; then +if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + # Wayland + tr '\0' '\n' < "$selection" | wl-copy +elif type xsel >/dev/null 2>&1; then # Linux tr '\0' '\n' < "$selection" | xsel -bi elif type xclip >/dev/null 2>&1; then @@ -42,9 +45,6 @@ tr '\0' '\n' < "$selection" | clip.exe elif type clip >/dev/null 2>&1; then # Cygwin tr '\0' '\n' < "$selection" | clip -elif type wl-copy >/dev/null 2>&1; then - # Wayland - tr '\0' '\n' < "$selection" | wl-copy elif type clipboard >/dev/null 2>&1; then # Haiku tr '\0' '\n' < "$selection" | clipboard --stdin diff --git a/plugins/x2sel b/plugins/x2sel index 70104d77c90433b83b6bf9c6dab1e7e45b7245ae..95414fc469926cf62638d887e244d7e813e0cac0 100755 --- a/plugins/x2sel +++ b/plugins/x2sel @@ -23,7 +23,10 @@ selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} getclip () { - if type xsel >/dev/null 2>&1; then + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + # Wayland + wl-paste + elif type xsel >/dev/null 2>&1; then # Linux xsel -bo elif type xclip >/dev/null 2>&1; then @@ -41,9 +44,6 @@ powershell.exe Get-Clipboard elif [ -r /dev/clipboard ] ; then # Cygwin cat /dev/clipboard - elif type wl-paste >/dev/null 2>&1; then - # Wayland - wl-paste elif type clipboard >/dev/null 2>&1; then # Haiku clipboard --print