Updated OS X screenshot code to support multiple desktops.

This commit is contained in:
Thomas Bouve
2014-02-03 15:00:40 +01:00
parent c6150b29a9
commit b069418eed

View File

@@ -1755,7 +1755,15 @@ detectdroid () {
takeShot () {
if [[ -z $screenCommand ]]; then
if [[ "$hostshot" == "1" ]]; then
if [ "$distro" == "Mac OS X" ]; then printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x "${shotfile}" &> /dev/null
if [ "$distro" == "Mac OS X" ]; then
screenCommand="screencapture -x ${shotfile}"
displays="$(system_profiler SPDisplaysDataType | grep 'Resolution:' | wc -l | tr -d ' ')"
for (( i=2; i<=$displays; i++))
do
screenCommand="${screenCommand} $(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")"
echo ${screenCommand}
done
printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; ${screenCommand} &> /dev/null
else scrot -cd3 "${shotfile}"; fi
if [ -f "${shotfile}" ]; then
[[ "$verbosity" -eq "1" ]] && verboseOut "Screenshot saved at '${shotfile}'"
@@ -1765,7 +1773,15 @@ takeShot () {
verboseOut "ERROR: Problem saving screenshot to ${shotfile}"
fi
else
if [ "$distro" == "Mac OS X" ]; then printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x "${shotfile}" &> /dev/null
if [ "$distro" == "Mac OS X" ]; then
screenCommand="screencapture -x ${shotfile}"
displays="$(system_profiler SPDisplaysDataType | grep 'Resolution:' | wc -l | tr -d ' ')"
for (( i=2; i<=$displays; i++))
do
screenCommand="${screenCommand} $(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")"
echo ${screenCommand}
done
printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; ${screenCommand} &> /dev/null
else scrot -cd3 "${shotfile}"; fi
if [ -f "${shotfile}" ]; then
[[ "$verbosity" -eq "1" ]] && verboseOut "Screenshot saved at '${shotfile}'"