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
  • 3,098

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

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

sudo apt-get install grandr
Zanna
  • 72,312
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
  • 3,098