5

I have a Ubuntu machine next to my TV. Sometimes I use my TV (hdmi) as a secondary monitor, twinview.

Using the "NVidia X Server Setting", nvidia-settings, I can turn the second monitor (TV) on or off. (NVidia driver version is 260.19.06)

However, since I do this quite frequently I would like to install a keyboard shortcut. So step one is to turn on/off the 2nd monitor using command line.

Any idea on how to control this, using command line?

Cheers Leif

leiflundgren
  • 245
  • 3
  • 11

2 Answers2

8

disper has worked very well for me for controlling an nVidia card for the same purpose. My second display was a TV, btw. You can install disper from this ppa: https://launchpad.net/~disper-dev/+archive/ppa

Li Lo
  • 15,506
  • 4
  • 38
  • 40
  • This program allows me to switch to a second monitor without restarting xserver! This is what I was looking for! My dream came true! ;) Many thanks for this! – lukasz Oct 27 '10 at 11:02
  • From an anonymous user: since nvidia 302 disper does not work any more // before this upgrade it worked very well for me – nanofarad Sep 07 '12 at 00:05
2

try nvidia-settings -h

I'm not sure about this, but nvidia-settings seams to be a graphical front-end to edit ~/.nvidia-settings-rc

So if you save this file, use nvidia-settings, to add the TV display and save your settings, you should have two configuration files for your two setups.

Now use nvidia-settings -l conffile to change the configuration.

A bashscript could look like:

#!/bin/bash
mv conf1 tmp.conf1
mv conf2 conf1
mv tmp.conf1 conf2
nvidia-settings -l conf1

So this would toggle between the two settings

Oli
  • 289,791
  • 117
  • 680
  • 835
sBlatt
  • 4,399
  • 3
  • 23
  • 20
  • Sounds prommising, but. Tried. nvidia-settings -V --load-config-only --config=.nvidia-settings-rc-onemonitor-only And nothing happendedn. I would have suspected screens blinking and shuting down. Can you spot an obvious error on my part? Regards – leiflundgren Oct 27 '10 at 20:27
  • 1
    I just tried it, it does not seam to work :( If you check nvidia-settings -q you see that most attributes are read only, and the values you need are not saved in .nvidia-settings-rc, so until somebody comes up with a way to correctly handle nvidia-settings my answer is useless – sBlatt Oct 28 '10 at 08:50