I programmed in Basic in the 80' and 90' and Pascal/Delphi in early 00'. After that Python and Django for the usual web stuff. It's been awhile since I did major projects - mainly Python scripts now if needed (scraping and data)...If I would to build this kind of app from scratch where do I start?
Go to the wayland authority repo for interfaces, see if there is such interface (there could be many in dev), then find a wayland compositor which supports such interface(s) (or code such compositor). Then write your app code to query if a wayland compositor supports such interface:
- if not, gracefully fail.
- if it does, screenshot your surfaces.
That said, it is more an internal feature of a wayland compositor itself. So it seems more appropriate that a wayland compositor supports or not such feature, and if so, optionaly allows an application to remote control of feature via a specific out-of-core wayland interface.
I would feel better if it stays into the wayland compositior without the possibility for an external apps to snapshot everything.
That said, you could fiddle with platform specific stuff to shorcut the wayland compositor (on linux, drm mode settings and framebuffers).
I haven't used it personally - I hacked together a Guile script to wrap a few tools (grim, slurp, tesseract for OCR..., wofi), and then bound my script to a shortcut in my WM.
You should check out Flameshot and Spectacle if you want feature-complete screenshot apps on Wayland. If those don't suit your needs, then you should consider a custom solution.