You are not logged in.

#1 2015-02-18 01:27:16

Dalian
Member
From: Romania
Registered: 2015-01-31
Posts: 22

[solved]cannot disable external monitor in xrandr

I have a laptop with an integrated intel card and a dedicated nvidia, and I'm trying to run xorg solely on nvidia. I followed the optimus wiki and it worked, however when xorg starts I have 2 displays (Built-in is secondary) even though I have no external monitor connected. I looked everywhere and came across this command

xrandr --output VGA-0 --off

It successfully disabled the additional screen, but if I add it to my .xinitrc file, it won't take, and rebooting will only bring up 2 screens again. This is my xrandr output:

xrandr -q
Screen 0: minimum 8 x 8, current 1366 x 768, maximum 16384 x 16384
VGA-0 connected primary 1024x768+138+0 (normal left inverted right x axis y axis) 0mm x 0mm panning 1228x768+138+0 tracking 1366x768+0+0 border 0/0/0/0
   1024x768      60.00*+
   800x600       72.19    60.32    56.25  
   640x480       59.94  
   512x384       60.00  
   400x300       72.19  
   320x240       60.05  
LVDS-1-0 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1366x768      60.00*+
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   800x600       60.00    60.32    56.25  
   700x525       59.98  
   640x512       60.02  
   640x480       60.00    59.94  
   512x384       60.00  
   400x300       60.32    56.34  
   320x240       60.05  
VGA-1-0 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1-0 disconnected (normal left inverted right x axis y axis)
  1024x768 (0x49) 65.000MHz
        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 (0x4e) 40.000MHz
        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 (0x4f) 36.000MHz
        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 (0x53) 25.175MHz
        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
  512x384 (0x54) 32.500MHz
        h: width   512 start  524 end  592 total  672 skew    0 clock  48.36KHz
        v: height  384 start  385 end  388 total  403           clock  60.00Hz
  320x240 (0x57) 12.587MHz
        h: width   320 start  328 end  376 total  400 skew    0 clock  31.47KHz
        v: height  240 start  245 end  246 total  262           clock  60.05Hz 

And this is my xorg.conf:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    # e.g. BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    Option "AccelMethod"  "none"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

my .xinitrc:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output VGA-0 --off
xrandr --auto

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

  exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice

Last edited by Dalian (2015-02-19 00:23:30)

Offline

#2 2015-02-18 02:39:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [solved]cannot disable external monitor in xrandr

Combine the three xrandr lines in your xinitrc.  There is no reason for them to be separate, and the third overrides/undoes the second.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2015-02-18 04:59:23

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [solved]cannot disable external monitor in xrandr

In addition to what Trilby said, the xrandr with the "--auto" option should probably not be your last line. If you insist in adding it (I don't know if it is really necessary for your purposes), then it fits better being the first xrandr command.

Offline

#4 2015-02-18 15:04:09

Dalian
Member
From: Romania
Registered: 2015-01-31
Posts: 22

Re: [solved]cannot disable external monitor in xrandr

If i take out the --auto option and run startx i just get a black screen. There is a problem with the --output --off command but i can't quite place it. Is there any other way to run it on startup other than put it in .xinirc ? Perhaps set it as a startup command ? Seems like a cheap workaround to me. Or perhaps I can alter the xorg.conf so as not to load another screen ?
EDIT : Solved. Had to place xrandr--auto in between the other two.

Last edited by Dalian (2015-02-19 00:24:41)

Offline

Board footer

Powered by FluxBB