2

When i attach my Notebook (Nvidia Geforce GT 240M) to my Panasonic-TV via HDMI, both screens are activated. I use Nvidia-Driver Version 260.19.06.

I wonder how to deactivate my notebook display automatically or with one Script and switch to the external Monitor when attached. The TV needs an overscan-correction of 100px to display the whole screen.

I also want to close the notebook without deactivating the external monitor, what still happens now.

Is this possible?

bdr529
  • 2,978

3 Answers3

2

Here is a simple script to turn off notebook display when external monitor is connected:

if xrandr -q | grep -q  "HDMI connected"; then
  xrandr --output LVDS --off --output DFP1
else
  xrandr --output VGA --off --output LVDS
fi

If you want to set a specific resolution, you may add "--mode 1680x1050" in the end of xrandr lines. Output offset can be added using "--pos 100x0" command.

The script can be bound to any unused key combination or executed on startup using "System>>Preferences>>Startup Applications"

Note, that "DFP1" may be different on your system - check out 'xrandr -q' output with external monitor attached

  • 1
    Thank you, i will try this at home. So if i want an overscan correction of 100px from a 1920x108 resolution, i have to add: --mode 1820x950 --pos100x100? And how can i prevent my notebook to disable display when closing the lid? – bdr529 Feb 15 '11 at 13:35
  • --mode and --pos are indepndent - set mode to 1920x1080 and pos to 100x100 or whatever you need. You may to calibrate these values, trying them in Terminal. – Vadim Rutkovsky Feb 15 '11 at 16:00
  • After notebook display is off, the lid won't blank both displays – Vadim Rutkovsky Feb 15 '11 at 16:01
  • With xandr i get the following message: xrandr: Failed to get size of gamma for output default Screen 0: minimum 320 x 175, current 1366 x 768, maximum 1366 x 768 default connected 1366x768+0+0 0mm x 0mm 1366x768 50.0* ... So my Panasonic can't be detected. Nvidia-Settings recognizes it correctly. What can i do? – bdr529 Feb 16 '11 at 19:11
  • @bdr529, it seems, that maximum available resolution is 1366x768, so replace '1920x1080' with '1366x768' (I guess, that is actual for LVDS string) – Vadim Rutkovsky Feb 17 '11 at 14:10
1

Graphical gtk tool to do the same thing: grandr. It's in the official repos so you can

sudo apt-get install grandr
Zanna
  • 70,465
nejode
  • 501
1

So at least i found a solution for my problem.

What i found out is, that xrandr is nor supported by the propietary NVIDIA-drvers. Xrandr even can't detect my displays. The nvidia tool nvidia-settings can be used from command line, but is not capable to activate or deactivate screens.

To switch displays you can use the tool disper: disper on launchpad It's a command line tools, wich exactly fits my problem an is easy to use.

Some example scripts for automatic switching at startup can be found here: Ubuntuusers.de wiki

Hope, that this may help someone.

bdr529
  • 2,978