Ubuntu – Refresh display settings – using xrandr / Laptop screen off, external screen on

command linedisplaymultiple-monitorsxrandr

I set the display settings of my laptop so that when an external screen is plugged in, only the external screen is used. However, when I plug it in after being logged into Ubuntu, it stays as if no screen was plugged in.
That is not a big problem since the display settings refresh after I go into "System Settings" > "Displays".

That is kind of unhandy, so I would like to use the terminal to refresh the display settings. I guess it has something to do with an xrandr command. I tried xrandr --dryrun, this works but outputs a lot of stuff. It doesn't seem to be the right command.

What is the correct command?

Best Answer

You can use the following command:

xrandr --auto && xrandr --output --left-of

or

xrandr --auto && xrandr --output --right-of

depending how your screen are arranged in System SettingsDisplays.

See man xrandr for more info.

Related Question