xrandr to set display to use single monitor, even if you have another monitor connected or disconnected

10,575

Solution 1

You've actually given a fairly good answer that I really can't match up. So, let me explain my use case for xrandr, in hoping that the next person might be able to benefit from us both.

Hopefully my use case for xrandr is a more common one. I plugged in my laptop to HDMI so that I can watch movies from my big TV, but my Xfce isn't giving me any option to turn my laptop's monitor (LVDS) off while watch movies on TV.

So I use

xrandr --output LVDS --off

to turn of my laptop's monitor (LVDS) off, in order to prolong its life. Then use

xrandr --output LVDS --auto

to bring it back after I've done watching movies.

That's my use case. In the case when you've unplugged the monitor from you laptop, but BADLY need to see the apps on the secondary monitor even without one, you can increase virtual X space and just panning with the mouse to there as explained here. For you specific case, it can be:

xrandr --size 1366x768 --panning 3286x1080

It is doable but not practical, that why I emphasized on "BADLY need" :-)

Thanks for your 10 points

Solution 2

I didn't find any posts explaining how to use xrandr to get a single monitor working and figured it out by trail and error. To resolve issues the following command or combinations work.

  1. With my work secondary monitor connected.

    To go down to a single monitor which ever is primary
    Get the resolution of that monitor
    xrandr --size 1366x768
    That takes me down to only my primary monitor even if the other monitor is still connected. The follow may also be useful.
    xrandr --output HDMI1 --off

  2. If I unplug this monitor to move my laptop. I loose every thing on that screen. Its still running but I can see it.

    Or the same command as above
    xrandr --size 1366x768

  3. If I am already logged in I only see the output of the first monitor, even after connecting the second monitor.

    xrandr --output HDMI1 --auto --right-of LVDS1
    That should resolve this problem, to get the second monitor working.
    IF it is still not displaying any thing on the second monitor
    xrandr --size 3286x1080

I did find that google-chrome lost its scaling for some reason and the whole interface be came unusable. This post helped me solve those issues https://code.google.com/p/chromium/issues/detail?id=473089

# xdpyinfo | grep -B 1 resolution
dimensions:    1366x768 pixels (869x285 millimeters)
resolution:    40x68 dots per inch
xrandr --dpi 96
Share:
10,575

Related videos on Youtube

nelaaro
Author by

nelaaro

Linux admin, tech enthusiast. opensource evangelist.

Updated on September 18, 2022

Comments

  • nelaaro
    nelaaro over 1 year

    xrandr to set display to use single monitor, even if you have another monitor connected or disconnected

    I have a laptop that can move and be connected to different monitors etc through out the day.

    I usually exit my windows manager and login again every time I disconnect, to have this done automatically for me.

    I would like to stay logged in and use the same tool that does the auto-detection and set up or doing it using xrandr. I guess I am just unfamiliar with the different tools available.

    1. With my work secondary monitor connected. I get the following.
    xrandr  
    

    Screen 0: minimum 8 x 8, current 3286 x 1080, maximum 32767 x 32767
    LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
    1366x768 60.0*+
    1360x768 59.8 60.0
    1024x768 60.0
    800x600 60.3 56.2
    640x480 59.9
    DP1 disconnected (normal left inverted right x axis y axis)
    HDMI1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 510mm x 287mm
    1920x1080 60.0*+ 50.0 59.9
    1680x1050 59.9
    1600x900 60.0
    1280x1024 75.0 60.0
    1440x900 59.9
    1280x800 59.9
    1152x864 75.0
    1280x720 60.0 50.0 59.9
    1024x768 75.1 70.1 60.0
    832x624 74.6
    800x600 72.2 75.0 60.3 56.2
    720x576 50.0
    720x480 60.0 59.9
    640x480 75.0 72.8 66.7 60.0 59.9
    720x400 70.1
    VGA1 disconnected (normal left inverted right x axis y axis)
    VIRTUAL1 disconnected (normal left inverted right x axis y axis)

    1. If I unplug this monitor to move my laptop. I loose every thing on that screen. Its still running but I can see it.

    # xrandr
    Screen 0: minimum 8 x 8, current 3286 x 1080, maximum 32767 x 32767
    LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
    1366x768 60.0*+
    1360x768 59.8 60.0
    1024x768 60.0
    800x600 60.3 56.2
    640x480 59.9
    DP1 disconnected (normal left inverted right x axis y axis)
    HDMI1 disconnected 1920x1080+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm
    VGA1 disconnected (normal left inverted right x axis y axis)
    VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    1920x1080 (0x49) 148.5MHz
    h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.5KHz
    v: height 1080 start 1084 end 1089 total 1125 clock 60.0Hz

    1. If I am already logged in I only see the output of the first monitor, even after connecting the second monitor.

    # xrandr Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767 LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm 1366x768 60.0*+ 1360x768 59.8 60.0
    1024x768 60.0
    800x600 60.3 56.2
    640x480 59.9
    DP1 disconnected (normal left inverted right x axis y axis) HDMI1 connected (normal left inverted right x axis y axis) 1920x1080 60.0 + 50.0 59.9
    1680x1050 59.9
    1600x900 60.0
    1280x1024 75.0 60.0
    1440x900 59.9
    1280x800 59.9
    1152x864 75.0
    1280x720 60.0 50.0 59.9
    1024x768 75.1 70.1 60.0
    832x624 74.6
    800x600 72.2 75.0 60.3 56.2
    720x576 50.0
    720x480 60.0 59.9
    640x480 75.0 72.8 66.7 60.0 59.9
    720x400 70.1
    VGA1 disconnected (normal left inverted right x axis y axis) VIRTUAL1 disconnected (normal left inverted right x axis y axis)

  • xpt
    xpt over 8 years
    Ha, you beat me, I figured it out by trail and error as well. "If I unplug this monitor to move my laptop. I loose every thing on that screen. Its still running but I can't see it", if you really want to see them even without the secondary monitor, check out sfxpt.wordpress.com/2011/02/02/panning-using-xrandr
  • nelaaro
    nelaaro over 8 years
    @xpt, I can't accept my own answerers, and you blog is a pretty good answer. Please post some thing to get those 10 points from me.
  • nelaaro
    nelaaro over 8 years
    In all my googleing, I could not find a link that answered my specific question. @xpt, if you have some more to add, I will defiantly appreciate it.