diff --git a/clipboard-adapter.sh b/clipboard-adapter.sh index 891c65d..ff8501c 100755 --- a/clipboard-adapter.sh +++ b/clipboard-adapter.sh @@ -52,6 +52,23 @@ handle_copy() { esac } +handle_primary() { + case "$1" in + xsel) + xsel --primary --input + ;; + xclip) + xclip -selection primary -in + ;; + wl-copy) + wl-copy --primary + ;; + *) + show_error "$1 has no implementation for copying yet" + exit 1 + esac +} + # Print out the first argument and return true if that argument is an installed # command. Prints nothing and returns false if the argument is not an installed # command. @@ -86,6 +103,7 @@ case "$1" in copy) shift printf "%s" "$*" | handle_copy "$tool" + printf "%s" "$*" | handle_primary "$tool" ;; *) show_error "$0: Unknown command \"$1\""