Created
October 2, 2024 15:12
-
-
Save BebeSparkelSparkel/3e2a2c5c1725fcce6c679343fd23112a to your computer and use it in GitHub Desktop.
`xclip-clipboard` a sh wrapper for xclip that defaults the selection to XA_CLIPBOARD instead of XA_PRIMARY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for arg in "$@" | |
do | |
if [ "$arg" = "-selection" ] | |
then | |
echo "Error: -selection argument is not allowed in this xclip wrapper. Use xclip directly instead." >&2 | |
exit 1 | |
elif [ "$arg" = "-h" -o "$arg" = "-help" ] | |
then | |
echo 'xclip-clipboard: A wrapper for xclip that always uses the clipboard selection.' >&2 | |
echo 'All xclip options are supported except -selection.\n' >&2 | |
xclip "$@" 2>&1 | fgrep -v "selection" | sed 's/xclip/xclip-clipboard/g' 1>&2 | |
exit 0 | |
fi | |
done | |
# Execute xclip with clipboard selection and all other arguments | |
exec xclip -selection clipboard "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment