mirror of
https://github.com/jarun/nnn.git
synced 2025-01-15 13:26:37 +00:00
Add correct check for Wayland in clipboard plugins
This commit is contained in:
parent
07c5590db3
commit
0c234060bf
|
@ -24,7 +24,10 @@ IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
|
||||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||||
[ -s "$selection" ] || { echo "plugin .cbcp error: empty selection" >&2 ; exit 1; }
|
[ -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
|
# Linux
|
||||||
tr '\0' '\n' < "$selection" | xsel -bi
|
tr '\0' '\n' < "$selection" | xsel -bi
|
||||||
elif type xclip >/dev/null 2>&1; then
|
elif type xclip >/dev/null 2>&1; then
|
||||||
|
@ -42,9 +45,6 @@ elif type clip.exe >/dev/null 2>&1; then
|
||||||
elif type clip >/dev/null 2>&1; then
|
elif type clip >/dev/null 2>&1; then
|
||||||
# Cygwin
|
# Cygwin
|
||||||
tr '\0' '\n' < "$selection" | clip
|
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
|
elif type clipboard >/dev/null 2>&1; then
|
||||||
# Haiku
|
# Haiku
|
||||||
tr '\0' '\n' < "$selection" | clipboard --stdin
|
tr '\0' '\n' < "$selection" | clipboard --stdin
|
||||||
|
|
|
@ -23,7 +23,10 @@ IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" # protect trailing \n
|
||||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||||
|
|
||||||
getclip () {
|
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
|
# Linux
|
||||||
xsel -bo
|
xsel -bo
|
||||||
elif type xclip >/dev/null 2>&1; then
|
elif type xclip >/dev/null 2>&1; then
|
||||||
|
@ -41,9 +44,6 @@ getclip () {
|
||||||
elif [ -r /dev/clipboard ] ; then
|
elif [ -r /dev/clipboard ] ; then
|
||||||
# Cygwin
|
# Cygwin
|
||||||
cat /dev/clipboard
|
cat /dev/clipboard
|
||||||
elif type wl-paste >/dev/null 2>&1; then
|
|
||||||
# Wayland
|
|
||||||
wl-paste
|
|
||||||
elif type clipboard >/dev/null 2>&1; then
|
elif type clipboard >/dev/null 2>&1; then
|
||||||
# Haiku
|
# Haiku
|
||||||
clipboard --print
|
clipboard --print
|
||||||
|
|
Loading…
Reference in a new issue