Firefox (84+) supports this method by default, while on Chromium (73+) one needs to enable WebRTC PipeWire support by setting the corresponding (experimental) flag at the URL chrome://flags/#enable-webrtc-pipewire-capturer.
This requires xdg-desktop-portal and one of its backends to be installed. The available backends are:
xdg-desktop-portal-gnomefor GNOME.xdg-desktop-portal-kdefor KDE.xdg-desktop-portal-wlrfor wlroots-based Wayland compositors (e.g. Sway, dwl)