LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to put these 2 simple commands into xorg.conf? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-put-these-2-simple-commands-into-xorg-conf-4175476210/)

stozi 09-06-2013 01:42 PM

how to put these 2 simple commands into xorg.conf?
 
Hi I can see how to do one or the other, but I don't quite get how to set up xorg.conf with both these settings:

xrandr --output LVDS-0 --off

xrandr --output VGA-0 --mode 1280x1024

Thanks for any help!

Keith Hedger 09-06-2013 02:42 PM

xrandr is an X command ie it can only be run from an X server you can't put it in the xorg.conf.

A bit more information on what you want to accomplish would help also your xorg.conf, in the meantime have a look at the man page for xorg.conf.

Habitual 09-06-2013 03:41 PM

/etc/rc.local depending on Distro...

Keith Hedger 09-06-2013 06:22 PM

Quote:

Originally Posted by Habitual (Post 5023272)
/etc/rc.local depending on Distro...

I don't think that would work a xrandr has to be run from within X you cant for instance start X switch to a console and then run xrandr.

I'm pretty sure that every thing that you can do with xrandr you can do by correctly configuring xorg after all xrandr is just the X interface to Xorgs randr module

stozi 09-07-2013 01:24 AM

Another way of putting it is that I want to use xorg.conf instead of running these commands every time I boot.

I want LVDS-0 off and VGA-0 res 1280x1024

xorg.conf is really complicated, I don't have one right now, but apparently I need it for these settings. I'm not sure what all I must put in there just to get these two simple settings.

Thanks again

jpollard 09-07-2013 02:54 AM

Try putting the following in /etc/X11/xorg.conf.d under the name "02-screen.conf"
Code:

Section "Default Screen Section"
    Identifier        "Screen0"
    Device        "Card0"
    Monitor        "Monitor0"
    DefaultDepth        24
    SubSection        "Display"
        Viewport        0 0
        Depth                24
        Modes                "1280x1024"
    EndSubSection
EndSection

I hope the Identifier, Device, and Monitor lines have the default names used as I don't know for sure what they should be. The names I give above are from a generic run of "Xorg -configure" which will generate a mostly valid configuration based on the hardware installed. I say mostly, because it cannot tell at configure time whether the monitors attached are actually valid - so if a videocard supports multiple (my card has three, but only two have plugs, and of those two, only one is used), it will define multiple, which will cause errors when it tries to actually use that configuration.

The Subsection "Display" specify the number of bits to use and the display specifies the resolution (the Modes line). There can be multiple modes, which should allow you to cycle through the list (ctrl-alt-+ or ctrl-alt-- (the +/- last character is from the keypad)). You can find valid modes to list in your /var/log/Xorg.0.log files identified by lines with "Modeline" followed by the mode name, and a list of timing numbers associated with that specific mode.

And if all else fails, delete the file (sorry about that).

Oh - forgot. You will have to log out before it will take effect. Just be sure you can login through a console virtual terminal (ctrl-alt-F2/3/...) to delete the file. If it doesn't work, the X display will not start...

stozi 09-07-2013 03:08 AM

Hi thanks very much, I fooled around a bit and got the desired effect with /etc/X11/xorg.conf like so:
Code:

Section "Device"
        Identifier        "lappy"
        Driver                "modesetting"
        Option                "monitor-VGA" "VGA-0"
        Option                "monitor-LVDS" "LVDS-0"
EndSection

Section "Monitor"
        Identifier        "VGA-0"
        Option                "PreferredMode" "1280x1024"
EndSection

Section "Monitor"
        Identifier        "LVDS-0"
        Option                "Disable" "true"
Endsection

Is there anything wrong with this? is /etc/X11/xorg.conf.d/02-screen.conf more correct?

jpollard 09-07-2013 04:52 AM

Nope. The only advantage the /etc/X11 files have is a small amount of flexibility - the leading number on the name sets the order they are included. It just allows sections to be replaced/added with just a file removal/copy

What you have is fine.

Habitual 09-07-2013 07:38 PM

Quote:

Originally Posted by Keith Hedger (Post 5023344)
I don't think that would work a xrandr has to be run from within X you cant for instance start X switch to a console and then run xrandr.

I'm pretty sure that every thing that you can do with xrandr you can do by correctly configuring xorg after all xrandr is just the X interface to Xorgs randr module

You are quite correct as /etc/rc.local would process before the DM has loaded.

jpollard 09-08-2013 08:09 AM

Quote:

Originally Posted by Habitual (Post 5023849)
You are quite correct as /etc/rc.local would process before the DM has loaded.

The real problem is that the X server gets reset/restarted on every login/logout.

Putting it in rc.local does nothing (except generate errors) as the X server is not necessarily running, and even if running, will not have access to it.


All times are GMT -5. The time now is 06:25 AM.