Skip to content

'copy selection to system clipboard' not working when using multiple windowing systems. #152

@hereGittyGitty

Description

@hereGittyGitty

Hi there,

i can choose to use X11 or Wayland on my machine when logging in and therefore I have both xclip and wl-copy installed. Now wl-copy is always used when assigning the copy-command in the main function even though I might be using X11.

This is because the clipboard_copy_command checks solely on the existence of certain executables when deciding what to use for copying.

My first attempt to solve this would be the following patch:

diff --git a/scripts/helpers.sh b/scripts/helpers.sh
index 66beeec..ea5e017 100644
--- a/scripts/helpers.sh
+++ b/scripts/helpers.sh
@@ -148,7 +148,8 @@
         fi
     elif command_exists "clip.exe"; then # WSL clipboard command
         echo "cat | clip.exe"
-    elif command_exists "wl-copy"; then # wl-clipboard: Wayland clipboard utilities
+    elif command_exists "wl-copy" \
+        && [ ${XDG_SESSION_TYPE} = "wayland" ]; then # wl-clipboard: Wayland clipboard utilities
         echo "wl-copy"
     elif command_exists "xsel"; then
         local xsel_selection

Thx for the plugin though. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions