Swap the Ubuntu screens

Introduction

This task usually comes up when you connect an additional monitor to a laptop.

Suppose your new screen is on the left, but by default the system placed it on the right, and moving the mouse between them is very inconvenient

xrandr

Execute command xrandr and look for the lines with the word connected

xrandr

eDP-1 connected primary 1920x1080+2560+0 … … … DP-1 connected 2560x1440+0+0 … … …

You can see that the main laptop monitor is eDP-1 and the additional one is DP-1

To put DP-1 on the left, execute

xrandr --output DP-1 --left-of eDP-1

All possible positioning options:

To avoid running this command every time after a reboot, you can write a function in .bashrc

vi ~/.bashrc

function monitors_ { xrandr --output DP-1 --left-of eDP-1 }

Log in to the terminal again.

Now, to swap the screens, it is enough to run

monitors_

Read the full guide to the xrandr command here

Article author: Andrei Olegovich