Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying output by make / model / serial #320

Open
dbrgn opened this issue Oct 3, 2024 · 3 comments
Open

Allow specifying output by make / model / serial #320

dbrgn opened this issue Oct 3, 2024 · 3 comments

Comments

@dbrgn
Copy link

dbrgn commented Oct 3, 2024

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:

output 'Dell Inc. DELL U2724DE DZ4FCP3' pos 0 530

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:

static struct xdpw_wlr_output *xdpw_wlr_output_find_by_name(struct wl_list *output_list,
const char *name) {
struct xdpw_wlr_output *output, *tmp;
wl_list_for_each_safe(output, tmp, output_list, link) {
if (strcmp(output->name, name) == 0) {
return output;
}
}
return NULL;
}

Through output->make and output->model, I can access the make and model of the output. However, for a full comparison, I would need the serial as well. The xdpw_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.

@emersion
Copy link
Owner

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

@dbrgn
Copy link
Author

dbrgn commented Oct 17, 2024

I see 😕 How does Sway get access to the serial? Is that a custom implementation outside of Wayland?

@emersion
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants