PDA

View Full Version : [ubuntu] How to switch between single and dual monitors?



Paddy Landau
June 23rd, 2008, 06:00 PM
I usually use my laptop at my office desk connected to another monitor, using an extended desktop (dual monitors).

Sometimes, I leave the office. But then my laptop doesn't realise that a monitor is missing, and I can't use the computer.

I can solve this problem each time by changing the file /etc/X11/xorg.conf (I have a working copy of each version of xorg.conf so I can just copy the relevant version). However, that is a bit of a pain as either I have to remember to do this before shutting down, or I must boot in a recovery mode and make the change.

Question: Is it possible to write a script to check automatically when booting, and copy the relevent xorg.conf to /etc/X11?

markbuntu
June 23rd, 2008, 08:38 PM
What video card do you have and which driver is it using?

Paddy Landau
June 23rd, 2008, 10:17 PM
What video card do you have and which driver is it using?
I'm not entirely sure...

When I type
lspci | grep VGA
I get
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)

When I open Applications -> Other -> Screens and Graphics, it shows the Graphics Card as
i810 - Intel Integrated Graphics Chipsets (Intel 945)

I hope that helps.

Paddy Landau
June 24th, 2008, 12:25 PM
OK, I've found out how to tell whether I have a monitor running. I use the command
xrandr -q
and check the results with fgrep. I've written a script to make the change according to what's connected.

However, as the script replaces /etc/X11/xorg.conf, it needs to run as a superuser. Therefore, putting it into the start-up (System -> Preferences -> Sessions) doesn't work.

Do you know how I can get this script to run at start-up as a superuser?

Paddy Landau
June 24th, 2008, 10:46 PM
I've answered my own question about how to run it as root.

Use either update-rc.d or /etc/rc.local.

However, none of them works because of the timing of the run.

I shall just manually run the script whenever necessary.

Paddy Landau
July 1st, 2008, 10:44 AM
Much easier option:

Use xrandr (see the RandR HowTo (http://www.thinkwiki.org/wiki/Xorg_RandR_1.2)).