#!/bin/sh

set -eu

if command -v wl-copy >/dev/null 2>&1 && [ -n "${WAYLAND_DISPLAY:-}" ]; then
  exec wl-copy
fi

if command -v xclip >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
  exec xclip -selection clipboard -in
fi

if command -v xsel >/dev/null 2>&1 && [ -n "${DISPLAY:-}" ]; then
  exec xsel --clipboard --input
fi

if command -v clip.exe >/dev/null 2>&1; then
  exec clip.exe
fi

if command -v pbcopy >/dev/null 2>&1; then
  exec pbcopy
fi

cat >/dev/null
exit 1
