Take screenshot of current page

Is there any way to take a screenshot of the current buffer?

My user case would be to be able to generate a screenshot of a rendered website given an URL using a nyxt script.

If this doens’t exist yet, can someone guide me on the direction I should look into? I’m new to Common Lisp but I have good experience in Elisp hacking (if that helps).

This relates to a point suggested on github about having glyph representations of buffers in the buffer prompt.

What we already have is webkit_web_view_get_snapshot(), bound in cl-webkit as webkit:webkit-web-view-get-snapshot. It (or, rather, its twin, webkit-web-view-get-snapshot-finish) returns a raw cairo_surface_t, which should be processed into an image. You have to do it yourself at the moment, as Nyxt has no method wrapping around the WebKit snapshotting yet (we will be glad to accept a PR if you reach some sensible result, though!)

For clarification, is this a screenshot of the ENTIRE page of the current buffer, or of the currently visible portion, or what? For me, since I use Wayland, I just use grimshot on the active window…

WebKit allows both full page screenshot and current visible area one, so should be quite convenient.

Thanks, that is what I was looking for. I will try to play with these functions. I’ll let you know when I get something

1 Like