martin-ueding/thinkpad-scripts

X output names were renamed from LVDS1 to LVDS-1

martin-ueding opened this issue · 4 comments

When I started my system today, I saw that my display scripts no longer work flawlessly. This is because LVDS1 is now called LVDS-1 on current Fedora 25.

This change might be trickling down to other distributions in the next months/years, Arch Linux perhaps already has the change.

Since people have configuration files and our default explicitly lists LVDS1, there is something that needs to be done. In order to let most users ignore the issue, I think we should query XRandR and see how the outputs are named. Then one can to the conversion (\w+)(\d+) to \1-\2 quite easily from the values the users have set.

I just noticed that on my AMD Radeon R9 380 with the amdgpu open source driver on my other machine, the names have been DP-1, DVI-D-1, DVI-I-1 for quite a while now. Very interesting. Perhaps the names where unified now with a change in the Intel driver or so?

I haven't seen this yet (Arch Linux). I'd suggest that instead of reinterpreting existing configuration values, we make the following changes:

  1. Replace the screen.internal config parameter with a new parameter screen.internal_regex. Then, the default could be LVDS-?1, or even LVDS-?1|eDP-?1 to accommodate Thinkpad Yoga users (#92).

  2. Get the actual name of the internal display from xrandr, as you suggest. (Search using the obsolete screen.internal config parameter if it's set, or screen.internal_regex otherwise.) If the configured internal display cannot be found in the output of xrandr, warn the user and suggest they update their configuration. This would also help new users whose internal displays are named differently from the default (such as if they have different hardware).

This is my reasoning:

  1. I doubt many users have set the screen.internal configuration value themselves, so I would think simply changing the default would be sufficient for the vast majority of users. If users have set screen.internal and the name changes, then the warning would let them know to update their config.

  2. Reinterpreting the screen.internal config value two ways, such as LVDS1 being interpreted as LVDS1 or LVDS-1, is confusing to me. I think using a regex is clearer (and more flexible).

Yes, making a clean cut is better than changing the meaning of a variable.

Reading through the Fedora devel mailing list, I saw that changing the driver to the modesetting driver will change the names of the outputs. So Fedora 25 also has got the change to the modesetting driver. Therefore this change will also appear in Debian 9 and Ubuntu at some time. So this definitely is something that needs to be taken care of.

This feature is now implemented, together with a couple of unit tests for the new functions.

I have not pushed it yet because I have incorporated a snippet from Stack Overflow. Since all that is CC-BY-SA and I have linked it and we have a GPL project, is should be fine. However I have emailed the authors asking for permission. In the meantime one should just set screen.internal = LVDS-1 to get this working.