Reputation: 1687
The screencapture
terminal app is perfect and takes a screenshot just like you would expect, but it does only take a screenshot of the main window if you have two screens connected.
screencapture screenshot.png
But if you do CMD + Shift + 3
it takes both screens and saves them as two screenshots.
The man page has a parameter -m
, which says Only capture the main monitor
, but as you can see i do not use that parameter and you would then assume it would take of both screens, but no.
How can i make screencapture take both screen or program it to take a screenshot of the second screen?
Upvotes: 3
Views: 2913
Reputation: 11
This script works:
while [ 1 ]; do
date=$(date "+%Y%m%dT%H%M%S")
screencapture -x -D 1 ~/Desktop/"screen_${date}.png"
sleep 2
date=$(date "+%Y%m%dT%H%M%S")
screencapture -x -D 2 ~/Desktop/"screen_${date}.png"
sleep 2
done
The -D 1 and -D 2 command refer to the monitors connected
Upvotes: 1
Reputation: 1687
Found the solution 3 minutes later, but thought I would share the information since others would properly need it also :)
If you have multiple screens you will have to pass more file names, so if you have two screens you would do:
screencapture screen1.png screen2.png
The functionality is hidden is this message if you read carefully!
files where to save the screen capture, 1 file per screen
Upvotes: 10