Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow detection of wayland clipboard tools #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,24 @@ clipboard_copy_command() {
fi
elif command_exists "clip.exe"; then # WSL clipboard command
echo "clip.exe"
elif command_exists "xsel"; then
elif [ -n "$DISPLAY" ] && command_exists "xsel"; then
local xsel_selection
if [[ $mouse == "true" ]]; then
xsel_selection="$(yank_selection_mouse)"
else
xsel_selection="$(yank_selection)"
fi
echo "xsel -i --$xsel_selection"
elif command_exists "xclip"; then
elif [ -n "$DISPLAY" ] && command_exists "xclip"; then
local xclip_selection
if [[ $mouse == "true" ]]; then
xclip_selection="$(yank_selection_mouse)"
else
xclip_selection="$(yank_selection)"
fi
echo "xclip -selection $xclip_selection"
elif command_exists "wl-copy"; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check for -n $WAYLAND_DISPLAY, and I think wl-copy take precedence over xsel and copy, because apparently $DISPLAY can be non-empty on wayland, but $WAYLAND_DISPLAY should not be set on X.

echo "wl-copy"
elif command_exists "putclip"; then # cygwin clipboard command
echo "putclip"
elif [ -n "$(custom_copy_command)" ]; then
Expand Down