Just set WAYLAND_DISPLAY to the desired display (e.g.
wayland-0
).
But it's not convenient, in Rio even screenlock(1) works without setting env. Writing scripts which will set WAYLAND_DISPLAY for me is also a weird and tedious solution, I mean I'll have to replace executables in /bin with scripts. In this case I think it's best to write programs which will ignore WAYLAND_DISPLAY and simply figure out the primary display (and if they won't, they'll give up). Also I'm worried about that running programs outside of cage breaks transparency.