Refresh display settings - using xrandr / Laptop screen off, external screen on
Solution 1
For some reason the first answer did not work for me, but it brought me to to this command, which seems to do what I want:
xrandr --auto && xrandr --output LVDS --off
I will create an alias in the .bashrc.
Solution 2
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 Settings → Displays.
See man xrandr
for more info.
Related videos on Youtube
aldorado
Updated on September 18, 2022Comments
-
aldorado over 1 year
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 triedxrandr --dryrun
, this works but outputs a lot of stuff. It doesn't seem to be the right command.What is the correct command?
-
Radu Rădeanu over 10 years@aldorado Then use
xrandr --auto && xrandr --output --left-of
(orxrandr --auto && xrandr --output --right-of
). I told you to seeman xrandr
. -
aldorado over 10 yearsThis did not work for me for some reason, but combining
xrandr auto
by&&
helped me to get to a command that works for me. Thanks a lot! I will write it down as a possible answer.