I don't wanna poop on their parade, but haven't Wayland screenshotters been around for a while? https://github.com/emersion/grim
That one has at least been around for long enough, and has worked perfectly under Sway for long enough, that I had to look up its name because I had it bound to a hotkey and had forgotten what it was called.
grim can write the image to stdout. GUI like [1] can read images from stdin. You can make a script that pipes one to the other and bind that in your compositor.
That one has at least been around for long enough, and has worked perfectly under Sway for long enough, that I had to look up its name because I had it bound to a hotkey and had forgotten what it was called.