#!/bin/bash
# 将选中的文件/目录路径写入剪贴板（多选时每行一个）
text=""
for f in "$@"; do
    text+="$f"$'\n'
done
text=${text%$'\n'}

if [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null 2>&1; then
    printf '%s' "$text" | wl-copy
elif command -v xclip >/dev/null 2>&1; then
    printf '%s' "$text" | xclip -selection clipboard
elif command -v xsel >/dev/null 2>&1; then
    printf '%s' "$text" | xsel --clipboard --input
else
    notify-send "复制路径" "未找到剪贴板工具 (wl-copy/xclip)" 2>/dev/null
    exit 1
fi
