Open dbrgn opened 1 month ago
Unfortunately we don't have access to this information via Wayland. Finding a good way to identify an output is surprisingly difficult, see the discussion at: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/109#note_970789
I see 😕 How does Sway get access to the serial? Is that a custom implementation outside of Wayland?
Sway is the compositor, so has access to all of the information. xdg-desktop-portal-wlr is a client, so only has access to what's made available via the Wayland protocol.
Feature Description
I have monitors that frequently change their display port ID when turned off and back on. This is inconvenient because it breaks screensharing (I use
chooser_type=none
and a fixed output).In sway config, I can use a combination of make, model and serial as output specifier instead of the display port ID:
This matches the output format in
swaymsg -t get_outputs
.However, in xdpw, the
output_name
must be the display port ID for now (e.g. DP-5).It would be great, if matching by make/model/serial triple were supported in xdpw as well.
Implementation Notes
I looked at the code to find out how to implement support for the other variant as well. The relevant function is
xdpw_wlr_output_find_by_name
:https://github.com/emersion/xdg-desktop-portal-wlr/blob/d9ada849aeca6137915de2df69beaef4e272cc1d/src/screencast/wlr_screencast.c#L135-L144
Through
output->make
andoutput->model
, I can access the make and model of the output. However, for a full comparison, I would need the serial as well. Thexdpw_wlr_output
does not currently seem to include the relevant information.I looked at the code where xdpw gets its information from, and that seems to be the
wlr_output_handle_geometry
callback function. However, even there, only the make and model is available, but not the serial.Maybe someone here has more experience than me when dealing with wayland (my experience is 0), and would know where to obtain the serial? If yes, I could try to come up with a pull request for such a feature, if you @emersion would agree to such a change.