The Screenshots extension

The Screenshots extension saves the current window as an image file under the screenshots folder in your project. The default key that triggers saving the image is the space bar key.

To setup the screenshots we only need to add one line to our program:

fun main() = application {
    program {
        extend(Screenshots())
        extend {// -- draw here
        }
    }
}

The extension provides many configurable options. This example demonstrates how to adjust some of them:

fun main() = application {
    program {
        extend(Screenshots()) {
            key = "s"
            folder = "work-in-progress"
            async = false
        }
        extend {// -- draw here
        }
    }
}

To discover other configurable options you can use the autocomplete feature (ctrl+space by default) in IntelliJ Idea or explore its source code.

edit on GitHub