Hi all,

I have my laptop connected to an external monitor. When I open the laptop I want to have the display on the laptop, when it's closed it should go to external monitor. The problem is that I can't get the display on the monitor unless I open the laptop. Further, when I open the laptop I have the screen on the monitor looks like this-



I then run the following script and the display goes to the monitor properly.

Code:
if xrandr -q | grep -q  "VGA-0 connected"; then
  xrandr --output LVDS --off
  xrandr --output VGA  --off
  xrandr --output VGA  --mode 1680x1050
else
  xrandr --output VGA --off
  xrandr --output LVDS --off
  xrandr --output LVDS --mode 1280x800
fi
Can anyone please tell me why when the same script is in rc.local, it's not working properly? i.e., I can't get the display on the monitor unless I open the laptop initially.

I've checked xrandr -q and my xorg.conf and I don't see anything apparently wrong. Can anyone please tell me what I'm missing?

Here are xrandr -q output and my xorg.conf -

Code:
[root@x1002us ~]# xrandr -q
Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 1680 x 1050
VGA-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050      60.0*+   60.0     60.0* 
   1280x1024      75.0     59.9  
   1280x960       59.9  
   1152x864       75.0     74.8  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     66.7     60.0  
   720x400        70.1  
LVDS connected (normal left inverted right x axis y axis)
   1280x800       59.9 +   60.0  
   1280x768       60.0  
   1280x720       60.0  
   1024x768       60.0  
   800x600        60.3  
   640x480        59.9  
S-video disconnected (normal left inverted right x axis y axis)
[root@x1002us ~]#
My xorg.conf -
http://docs.google.com/Doc?id=ddjtzn4_4cc4hh3


Laptop has Radeon Mobility 7500 and external monitor is Samsung SyncMaster 225BW with 1680x1050 resolution.

Googling showed that many people have faced similar problem with radeon, and in most cases they have been able to get around with xrandr. Here are some threads using which I tried diffrerent things in them -

http://ubuntuforums.org/showthread.php?t=588570
http://burtonini.com/blog/computers/...07-02-06-17-50
http://ubuntuforums.org/showthread.php?t=561865

Any pointers/ suggestions greatly welcome.

Thanks in advance,
KM