Skip to content

RFC: Screenshot support by reading render surface and writing to file(s)#12056

Closed
justonia wants to merge 1 commit into
ghostty-org:mainfrom
justonia:screenshot-support
Closed

RFC: Screenshot support by reading render surface and writing to file(s)#12056
justonia wants to merge 1 commit into
ghostty-org:mainfrom
justonia:screenshot-support

Conversation

@justonia
Copy link
Copy Markdown

@justonia justonia commented Apr 2, 2026

The project I'm working on has the need to automate screenshot collection. I wanted to socialize interest in how this might be supported in Ghostty.

This RFC PR implements screenshot support in the most straightforward way:

  • Any thread calls ghostty_surface_screenshot(string path).
  • The call queues a message into the render thread's mailbox and also requests a redraw.
  • After the frame renders, the surface contents are read synchronously, encoded to png, and written to each path requested via ghostty_surface_screenshot.

I considered going the route of a callback-based approach:

typedef void (*ghostty_screenshot_cb)(void* userdata, const uint8_t* png_data, size_t len);

void ghostty_surface_screenshot(ghostty_surface_t surface, ghostty_screenshot_cb callback, void* userdata);

But, the file-based approach was simpler to prototype and I wanted to gauge interest in this functionality being a part of Ghostty at all before taking this further.

@justonia justonia requested review from a team as code owners April 2, 2026 04:19
@bo2themax bo2themax closed this Apr 2, 2026
@bo2themax
Copy link
Copy Markdown
Member

We should open a discussion for this first, I remember seeing a similar one

@justonia
Copy link
Copy Markdown
Author

justonia commented Apr 2, 2026

Was this the PR you're thinking of? #11601

@justonia
Copy link
Copy Markdown
Author

justonia commented Apr 2, 2026

@bo2themax Created a discussion: #12057

@00-kat
Copy link
Copy Markdown
Contributor

00-kat commented Apr 2, 2026

Just so you know: opening RFC PRs is almost always the wrong thing to do in the Ghostty repository; per CONTRIBUTING.md § Pull Requests Implement an Issue:

Pull requests are NOT a place to discuss feature design. Please do not open a WIP pull request to discuss a feature. Instead, use a discussion and link to your branch.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants