# Copies the contents of a given file to the system clipboard (Wayland).
# Modified by stillHQ for Wayland support.
#
# Usage: copyfile <file>
function copyfile {
  if [[ -z "$1" ]]; then
    echo "Usage: copyfile <file>" >&2
    return 1
  fi
  if [[ ! -f "$1" ]]; then
    echo "Error: '$1' is not a valid file." >&2
    return 1
  fi
  cat -- "$1" | wl-copy || return 1
  echo "${(%):-%B$1%b copied to clipboard.}"
}
