Update 2014-04-8: See this post on how to deal with two monitors on a single X screen.
This post is for those with separate X displays, who want to do timelapse screencapture. There are many utilities for doing this kind of timelapses, in particular, I'd recommend chronolapse, which does a very good job, even with multiple monitors. If that works for you, then go for it! However, if you have trouble with it working for separate X-displays as I did, or just want more control, read on!
There are several ways to take a screenshot from the command line. The
two most interesting utilities are
The environment variable
Putting it together with the
DISPLAY=:0.1 xwd -root -out screenshot-right.xwd
Since the goal was to have a picture-in-picture of one monitor shown on
top of the other, we will have to create this thumbnail. This is where the
ImageMagick utilities shine. First let's grab a screenshot:
Now, lets add a 2-pixel border, with the color
convert screen.xwd -thumbnail 300x300 \ -bordercolor "#881111aa" -border 2 thumbnail-border-300px.png
Let's add a nice falloff shadow, on a white background (so you can see it).
convert screen.xwd -thumbnail 300x300 \ -bordercolor "#881111aa" -border 2 \ \( +clone -background black -shadow 100x3+2+2 \) \ +swap -background white -layers merge +repage \ thumbnail-border-shadow-whitebg-300px.png
And of course, we want a transparent background, so for the sake of completeness:
convert screen.xwd -thumbnail 300x300 \ -bordercolor "#881111aa" -border 2 \ \( +clone -background black -shadow 100x3+2+2 \) \ +swap -background none -layers merge +repage \ thumbnail-border-shadow-nobg-300px.png
Here is how to place
convert -composite image-large.png thumbnail.png \ -geometry +100+20 imageoverlay.png
To execute a command every
This will exceute the script
Putting together the various pieces mentioned so far, this is the final script.
While I wrote this post, I had the above script running, and this is the produced video: