I have three monitors connected to my Ubuntu 18.04 box, and I'm struggling to get them to come up automatically configured how I want them. They all work by default, but I need to select which is primary, and configure resolutions, position, and scaling factor. In my case, I believe that the regular "settings->devices->displays" does not suffice. There are two reasons, first, there does not appear to be a way to select the primary monitor, second, I require a scaling factor that's fractional, and the settings only offer 100% or 200%.
I wrote a trivial script to achieve what I want using xrandr, and it works when executed manually after I have logged in. What I want, and have so far failed to achieve, is to get this script executed automatically. Ideally, it would be executed prior to presentation of the login screen and effective for all users, but it would be sufficient if it just executes when during the initialization that occurs immediately after login.
So far, I tried adding the script as a /etc/rc5.d/S01configure-monitors, which seemed to be partially effective, but certainly did not work properly. I also tried adding it as /etc/X11/Xsession.d/45configure-monitors and as .../97configure-monitors. Those two failed too (though I was able to verify that all location variants resulted in the script being executed)
What's the proper way to do this?
Чтобы запустить скрипт xrandr, который вызывается при входе в систему, вы можете поместить его в Startup Applications , если вы используете стандартный Gnome, или в
~ /.xinitrc должен работать, если вы используете
startx (если вы это сделаете, вам, возможно, придется поиграть с временем и порядком при запуске WM).