Every time I turn on my laptop and plug in my external monitor via HDMI, I need to go to the display settings to adjust the default settings. On start-up, I get a duplicated screen instead of the extended screen that I want. I also get my external monitor on the right when I always put it on the left. How can I make it so that by default it stays extended and on the left? Yes, I always put "apply" and "keep this configuration", but it seems to reset on startup.

xrandr output with the monitor set up exactly how I want:

Screen 0: minimum 8 x 8, current 3520 x 1080, maximum 32767 x 32767
LVDS1 connected primary 1600x900+1920+180 (normal left inverted right x axis y axis) 382mm x 215mm
   1600x900      60.01*+  40.03  
   1440x900      59.89  
   1368x768      60.00  
   1360x768      59.80    59.96  
   1152x864      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   800x450       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
DP-1-4 disconnected
HDMI-1-4 disconnected
HDMI-1-5 connected 1920x1080+0+0 510mm x 287mm
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.08    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
  1024x768 (0x55) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x59) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x5a) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  640x480 (0x62) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  • 1
    It's (kind of) a bug with some driver/screen combinations. Can be worked around. What is the output of xrandr with the screen setup as you want? please add it to your question. – Jacob Vlijm Jul 3 '16 at 17:23
  • @JacobVlijm added the output – whatwhatwhat Jul 3 '16 at 17:28
  • Hi whatwhatwhat, posted. It was done by heart, so please test all before applying :) – Jacob Vlijm Jul 3 '16 at 18:03
  • please mention if all is clear. – Jacob Vlijm Jul 3 '16 at 19:16
  • I have no explanation for that. The command shoud work. Is there any error? Will look at it tomorrow with a fresh mind. – Jacob Vlijm Jul 3 '16 at 20:05

Work around

Screen layouts that do not stick often happens when the graphics driver and the sreen somehow do not communicate in a sufficient way. However, that does not mean there is no solution.

The command to make your setup as you want it, is (if I made no mistake or typo):

xrandr --output HDMI-1-5 --pos 0x0 --output LVDS1 --pos 1920x180

WHy this is the command to do so is explained a.o. here.

How to use

You can use this command in two ways:

1. Manual version (shortcut)

Add it to a shortcut key to press once the second screen is connected: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:

xrandr --output HDMI-1-5 --pos 0x0 --output LVDS1 --pos 1920x180

2. Automaic version

Run this command automatically if the second screen is connected:

  • Copy the script below into an empty file, save it as set_screen.py

    #!/usr/bin/env python3
    import subprocess
    import time
    def numscreens():
        scrdata = subprocess.check_output("xrandr").decode("utf-8").splitlines()
        return len([l for l in scrdata if " connected" in l])
    nscr1 = None
    while True:
        nscr2 = numscreens()
        if nscr2 != nscr1:
            if nscr2 == 2:
                subprocess.Popen(["xrandr", "--output", "HDMI-1-5", "--pos", "0x0",
                                  "--output", "LVDS1", "--pos", "1920x180"])
        nscr1 = nscr2
  • Test run the script by running it from a terminal:

    python3 /path/to/set_screen.py
  • If all works fine, add it to Startup Applications: Dash > Startup Applications > Add. Add the command:

    /bin/bash -c "sleep 30 && python3 /path/to/set_screen.py"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.