neXromancers / shotgun

Minimal X screenshot utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shotgun Rust Library

Swivelgames opened this issue · comments

I use shotgun daily for taking screenshots. But it just occurred to me that it's written in Rust.

I have need for capturing screenshots, and I was wondering if there was any interest in providing shotgun as a lib, in addition to a cli tool.

Any chance the functionality here could be split out into a lib.rs that could be used by other Rust projects? If that was done, it may be relatively straightforward to have the main.rs as a wrapper for the lib to continue to provide functionality.

Thoughts?

This was previously requested in #6, and attempted in #21. I won't work on this but I'll review a PR implementing it.
The previous work may or may not be usable because the code has evolved since.

Here's what I would expect this to look like:

  • an options struct as a builder pattern
  • a single capture function that returns an unencoded image, with all the processing done
  • error reporting needs to be improved, right now we mostly discard error information but a library user should reasonably expect all errors to be propagated
  • the CLI should use the library API
  • ideally, the library user should be able to pass their own x11 connection