Proper implementation of imageFromApplication on Mac