# Ubuntu – Multi-monitor setup and arrangement globally (not per user)

20.04multiple-monitorsxorg

I have my desktop arranged with 3×27 monitors, two of which are in portrait mode. This works fine once I'm logged in to the normal display manager, but makes my lockscreen/login screen terrible (everything is rotated and unusable.)

In addition I have a few secondary user accounts for my friends etc who occasionally use the desktop; the monitor arrangment for them is broken horribly.

For lockscreens I found a few old answers involving hand-editing lightdm files (which don't even exist anymore :/).

What's the proper modern way to fix this?

(I'm going to ask a second question just about this, but I'm particular interested in a solution that'll also fix the question for xmonad, which I prefer to use.)

This applies on Ubuntu 20.04 (and also earlier versions.)

• Using arandr and xrandr to arrange and invoke the arrangement script respectively may solve your issue if you:

# First: Arrange the monitors.

In my case I just use a 2 monitor arrangement, but my configuration requires the monitor identified as HDMI-1 to be vertical, so I use arandr to arrange the monitors as I would like them to be used. Please see the next screenshot.

# Second: Save the screen arrangement script file

Once you're satisfied with your monitors arrangement, just hit the diskette (I don't know why it is a diskette nowadays but, whatever), and save your monitors arrangement in a shell script (.sh)

Don't forget where did you place the script

Please notice you can have as many scripts as you need for any desktop arrangement, anyway, the same script will work for any user if you use a copy or set the proper execution permissions for every single user.

In my case, the screen-home-office-vertical-right.sh file contains the next code:

xrandr --output HDMI-1 --mode 1280x1024 --pos 1366x0 --rotate left --output eDP-1 --mode 1366x768 --pos 0x512 --rotate normal


Notice that, learning from xrandr usage in a terminal will be really useful if you may wish to create your own commands. But if you wish to keep it simple, just go for arandr, it will be your best friend.

# Third: Run the script at boot on every user session.

But don't forget to give the script file the proper execution permissions (chmod +x scriptname.sh) or use the proper shell command to run it (bash scriptname.sh).

I am using i3wm as my Tiling Window Manager, so I can't say for other systems but in i3wm is as easy as running the script from cron, or from the i3 config file, or any other way.

You can also run it manually with a key combination. It is your time to do some research on your Window Manager/Desktop Environment.

# Fourth: Buy me a beer!

Ok no... Just vote for my answer or choose it as accepted if it does the trick for you.

Best regards.