When writing shotman
, good performance was the main goal. Writing it as a single tool that does everything helped get this through and iron out the quirks in the general design.
It should not be possible to split this into separate binaries. Or at least provide them as a proof of concept of how this can be split into multiple "tools that do one thing and one thing well". This should especially help untangle the spaghetti code that is the current codebase.
In particular, taking screenshots can be done by sm-capture --fd 4
, which takes a file descriptor. This descriptor is handed over to the compositor for the screen capture. This tiny tool should be usable by any other screenshot tool. sm-capture
will print the buffer format to stdout.