Skip to content

Instantly share code, notes, and snippets.

@mpjdem
Created August 5, 2019 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpjdem/4b7d3fe01865df944af91713ffe7732d to your computer and use it in GitHub Desktop.
Save mpjdem/4b7d3fe01865df944af91713ffe7732d to your computer and use it in GitHub Desktop.
Root window screenshot
take_screenshot <- function() {
xwid <-
system("xwininfo -root | sed -n 2p | grep -oP 0x[a-f0-9]+",
intern = TRUE)
magick::image_write(magick::image_read(paste0("x:", xwid)),
path = format(Sys.time(), "ss-%Y%m%d-%H%M%S.png"),
format = "png")
}
@mpjdem
Copy link
Author

mpjdem commented Aug 5, 2019

As discussed here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment