This uses xclip but those of us in Wayland can use wl-copy[1]. I have several scripts that automate screen grabbing[2][3], I have documented one of them[4]. My favorite is using [2], which grabs a screenshot and uploads it to a cloud provider and creates a public link for it and puts the link in my clipboard. It allows me to share the screenshot to any text-based communication so I can copy and paste screenshots inside apps that only accept text like Pidgin.
1: https://git.djha.skin/me/dotfiles/src/branch/main/dot-local/...
2: https://git.djha.skin/me/dotfiles/src/branch/main/dot-local/...
3: https://git.djha.skin/me/dotfiles/src/branch/main/dot-local/...
4: https://blog.djha.skin/p/planning-and-notes-using-markdown-i...