#!/bin/sh

if [ "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null; then
	exec wl-copy "$@"
elif [ "$DISPLAY" ]; then
	if command -v xsel >/dev/null; then
		exec xsel "$@"
	elif command -v xclip >/dev/null; then
		exec xclip "$@"
	fi
elif command -v tty-copy >/dev/null; then
	exec tty-copy "$@"
fi

echo 'yank: no clipboard command found' >&2
exit 1
