Now Manjaro is my major operating system for my desktop, I am joining the Arch team! With so many documentations available online it’s been a really good ride to customize my OS to my taste. Today I am gonna talk about my use for taking a screenshot, cropping it and copy it to the clipboard.
Most of the people when doing a screenshot doesn’t want the full screen to be captured, only the necessary part. Copying the picture to clipboard will also help you to paste it directly to applications like WYSIWYG editors or Telegram. I’ve written a 2 liner script that I can invoke to achieve this goal.
We will utilize the power of scrot tool. So first you need to install scrot.
sudo pacman -S scrot
Now let’s write a script called screenshot and save it as an executable file under one of the folders under your PATH variable.
rm -rf /tmp/xclip.png
scrot -s /tmp/xclip.png
xclip -sel clipboard -t image/png -i < /tmp/xclip.png
This way the /tmp/xclip.png file will be overridden every time you take a screenshot, also it provides the capability to use the file every time after you’ve taken a screenshot.