On an X.org session I can run the following script to create a replica of the currently focussed window:
#!/usr/bin/env bash
xdotool getwindowfocus | xargs -I% gst-launch-1.0 ximagesrc xid=% ! videoconvert ! autovideosink
This does not work on Wayland. Is there any alternative?