0

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?

TIA, Toby.

4
  • 1
    When you tried the xrandr script, did you put it in Startup Applications?
    – Zac Anger
    Aug 6, 2020 at 19:10
  • No, I'm not familiar with that. Is that a directory? I don't see one. Is it something I should find in the settings tool? I don't see anything there either? Aug 6, 2020 at 21:14
  • 1
    Depends on what DE or WM you're using, but if you're using stock Gnome, this answer should show how to find it: askubuntu.com/questions/48321/…
    – Zac Anger
    Aug 7, 2020 at 1:57
  • 1
    @ZacAnger thank you, that seems to have worked. For sure, the file I designate is executed, and the timing of it (that is, what order it takes effect relative to other things that affect screens) seems to be good too. Do you want to make that an answer, so I can mark it as such? Either way, much appreciated. Aug 7, 2020 at 21:42

1 Answer 1

1

To run an xrandr script that gets called on login, you can put it in Startup Applications if you're on stock Gnome, or putting it in ~/.xinitrc should work if you're using startx (if you do this, you may need to fiddle with timing and order when starting the WM).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .