slop (Select Operation) is an application that queries for a selection from the user and prints the region to stdout.
slop can be used to create a video recording script in only two lines of code.
#!/bin/bash
read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm
You can also take images using imagemagick like so:
#!/bin/bash
read -r G < <(slop -f "%g")
import -window root -crop $G ~/myimage.png
If you don't like ImageMagick's import: Check out maim for a better screenshot utility.
Ok. Here's a comparison between 'scrot -s's selection and slop's:
You can see scrot leaves garbage lines over the things you're trying to screenshot! While slop not only looks nicer, it's impossible for it to end up in screenshots or recordings because it waits for DestroyNotify events before completely shutting down. Only after the window is completely destroyed can anything take a screenshot.
Note: Dependencies should be installed first: libxext, OpenGL, and glm.
git clone https://github.com/naelstrof/slop.git
cd slop
cmake -DCMAKE_INSTALL_PREFIX="/usr" ./
make && sudo make install
These are implemented, but not flushed out. I haven't gotten around to writing some tutorials on them. So check back later!