#!/usr/bin/env bash # Clipboard helper functions for scripts # Source this in scripts that need clipboard access # Get clipboard content clip_get() { if command -v xsel &>/dev/null; then xsel --output --clipboard elif command -v xclip &>/dev/null; then xclip -selection clipboard -o elif command -v pbpaste &>/dev/null; then pbpaste else echo "Error: No clipboard tool found (install xsel or xclip)" >&2 return 1 fi } # Set clipboard content clip_set() { if command -v xsel &>/dev/null; then xsel --input --clipboard elif command -v xclip &>/dev/null; then xclip -selection clipboard elif command -v pbcopy &>/dev/null; then pbcopy else echo "Error: No clipboard tool found (install xsel or xclip)" >&2 return 1 fi }