# Copies the path of given directory or file to the system clipboard (Wayland).
# Copy current directory if no parameter.
# Modified by stillHQ for Wayland support.
function copypath {
  local file="${1:-.}"

  # If argument is not an absolute path, prepend $PWD
  [[ $file = /* ]] || file="$PWD/$file"

  # Copy the absolute path without resolving symlinks
  print -n "${file:a}" | wl-copy || return 1

  echo ${(%):-"%B${file:a}%b copied to clipboard."}
}
