-   Linux - Software (
-   -   Using nvidia-settings from the command line only (

0ddba11 06-07-2008 09:26 AM

Using nvidia-settings from the command line only
I'm pretty sure this problem must have come up before, but I am really struggling to find a solution.

Basically, I know I can use nvidia-settings to:
1. Enable Twinview on my external monitor
2. Disable my laptop display panel
3. Apply settings

This as you may have guessed is for when I dock my laptop.

The infuriating thing is that I can not find out how to do this from the command line so that it can be scripted and thus automated using ACPI events.

After quite a bit of digging, I have come to the conclusion that all that is really happening is that nvidia-settings is actually using xrandr to create the illusion of the other panel being disabled.

So what I'm I'm looking for is either a way to run nvidia-settings at the command line or tips on how to use xrandr to do whatever it is that nvidia-settings does with it.

0ddba11 06-07-2008 11:33 AM

Ok, so after having been into town, done a bit of shopping, stopped for a pint and a bowl of spicey chicken noodles, I thought I would have another try.

I managed to get some success by adding the lines listed in bold below to the 'screen' section of /etc/X11/xorg.conf


Section "Screen"
    Identifier    "Screen0"
    Device        "Videocard0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option        "TwinView" "1"
    Option        "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-1: NULL; DFP-1: nvidia-auto-select +0+0, DFP-0: NULL"


This now means that I can switch to my external monitor by using:


xrandr -s 1
and back again to the laptop display panel using:


xrandr -s 0
However, there is one flaw, and that is that unless X is started with the external monitor attached, xrandr does not display the correct modes. For example, if X is started with the external monitor, xrandr shows:


Screen 0: minimum 1280 x 800, current 1600 x 1200, maximum 1600 x 1200
default connected 1600x1200+0+0 0mm x 0mm
  1280x800      50.0 
  1600x1200      51.0*    50.0

Great, the two resolutions we need, but if X is started without the External monitor attached:


Screen 0: minimum 320 x 240, current 1280 x 800, maximum 1280 x 800
default connected 1280x800+0+0 0mm x 0mm
  1280x800      50.0*
  1152x768      51.0 
  1024x768      52.0 
  800x600        53.0    54.0 
  640x480        55.0 
  640x384        56.0 
  576x384        57.0 
  512x384        58.0 
  400x300        59.0    60.0 
  320x240        61.0

So by having to restart X to get xrandr to recognise the correct resolutions it defeats the whole point of the excersise!

I think I may be at a dead end now because it seems that only the Open Source nvidia driver supports hot plugging, and if I'm going to be going back to the open source driver, I might as well use xrandr like this:


xrandr --output LVDS --mode off;xrandr --output DVI1 --mode auto
Then I don't have to mess around with metamodes.

I think all this combined with the way some apps still loose their title bar when running compiz means that hacking around trying to get the proprietary driver to work just ain't worth it at the moment.

But the chicken noodles and beer deserve full credit for my progress this afternoon.

PMorph 06-07-2008 12:02 PM

To load settings from command line, I use:
nvidia-settings --config=~/.nvidia-settings-rc --load-config-only

Maybe you tried it already, but couldn't tell from your posts :)

enbuyukfener 06-08-2008 01:32 AM

You're a legend PMorph. Been looking for a solution for awhile now and seeing that nvidia-settings had no CLI, I went and tried messing with xrandr and things like that as 0ddba11 did. Didn't think of using nvidia-settings that way. Thanks a lot.

PMorph 06-08-2008 05:26 AM

Good to hear it was useful :)
I use that mainly for launching games from scripts (using several rc files), to adjust AA, AF etc. settings depending on how demanding the game is.

0ddba11 06-08-2008 11:23 AM


Originally Posted by PMorph (Post 3177634)
To load settings from command line, I use:
nvidia-settings --config=~/.nvidia-settings-rc --load-config-only

Maybe you tried it already, but couldn't tell from your posts :)

Hmmmmm, I have tried it but I think I might be missing something.

What I did was create two config files to load with nvidia-settings, onr for when I am docked, and one for when I am undocked. I created them by running the gui, changing the settings and quitting then copying the .nvidia-setting-rc file.

The trouble is that when I try to load the config files I get something like this:


gaz@gaz-laptop:~$ nvidia-settings --config=~/.nvidia-settings-undocked --load-config-only

ERROR: The attribute 'XVideoSyncToDisplay' specified on line 51 of configuration file
'/home/gaz/.nvidia-settings-undocked' cannot be assigned the value of DFP-0 (the currently
enabled display devices are DFP-1 on gaz-laptop:0.0).

And this is because I am disabling one of the displays but loading the config file doesn't seem to enable the display.

cscutcher 08-17-2008 10:16 AM

I'm having a similar problem. I think the reason you've had no luck with .nvidia-settings-rc is because it doesn't seem to have any settings related to enabling disabling screens.

sagyvolkov 08-19-2008 08:17 PM

nvidia command line
did anyone had a fix/solution for this issue?
looks like using nvidia-settings only let u load configuration, not applying it.

enbuyukfener 09-01-2008 10:03 AM

To anyone interested, Fn-F8 works after upgrading to 177.xx (at least in my case). Finally I can rid myself of the work around.

sagyvolkov 09-02-2008 01:36 AM

What's your hardware?

enbuyukfener 09-03-2008 02:06 AM


Originally Posted by sagyvolkov (Post 3266910)
What's your hardware?

NVidia Geforce 8600M GT PCI-E 512MB
Core 2 Duo and 2 GB RAM
Any other details you want?

Software if you are interested:

Mostly defaults

Arch Linux / Gnome / Compiz / Emerald

NVidia 177.68 driver (mentioned as 177.70 seems to have some regressions, haven't seen them for myself though)

Running this after nvidia has loaded for a slight improvement, not really noticeable though:
nvidia-settings -a InitialPixmapPlacement=2 -a GlyphCache=1


Section "Device"
    Identifier    "Geforce 8600M GT"
    Driver        "nvidia"
    VendorName    "NVIDIA Corporation"
    BoardName      "Geforce 8600M GT"
    Option        "PixmapCacheSize" "1000000"
    Option        "AllowSHMPixmaps" "0"
    Option        "OnDemandVBlankInterrupts" "True"
    Option        "NoLogo" "True"
    Option        "TripleBuffer" "True"
    Option        "BackingStore" "True"
    Option        "RenderAccel" "True"
    Option        "UseCompositeWrapper" "True"
    Option        "AllowIndirectPixmaps" "True"
    Option        "RenderAccel" "True"
    Option        "UseEvents" "False"
    Option        "DamageEvents" "1"

Read up on this before copying it. My one probably is not optimal, if not far from it.

sagyvolkov 09-05-2008 04:20 AM

Where did u get 177.x drivers? the Linux page at Nvidia shows only 173.x

allend 09-05-2008 04:55 AM

It may also be worth checking BIOS settings. With my Toshiba Satellite 1410 laptop there is a BIOS setting for the output to the external monitor, either Autoselect or Simultaneous. With Autoselect things are a hassle, but with Simultaneous all works just fine.

enbuyukfener 09-05-2008 11:38 PM


Originally Posted by sagyvolkov (Post 3270367)
Where did u get 177.x drivers? the Linux page at Nvidia shows only 173.x

Under the "get drivers by product" form on the download drivers page, there's a link to the beta drivers:

However, you should be doing stuff like this through your package manager. Simpler, saves time and less issues usually. The package is called nvidia-beta on Arch Linux for example.

jacksenechal 03-08-2009 04:22 PM

I was seeking a solution to quickly reconfigure my X display to swap between monitors. Actually, I wanted it to default to dual-screen twinview mode, and I wanted to be able to unplug the laptop and quickly reconfigure for single-display mode on the fly. Originally I'd thought to try nvidia-settings command line interface, but as it's revealed on this thread and others, nvidia-settings doesn't work for that.

After lots of searching and trying things I stumbled upon the program "disper". I installed the Ubuntu package and the program does exactly what I wanted.

I used nvidia-settings to save my dual-screen setup to xorg.conf so that it will default to that on boot-up. Then I used CompizConfig to bind a shortcut key to execute the command


disper -d auto -e
This auto-detects the display configuration and sets up the dual-monitor configuration if both are available. If the monitor isn't plugged in, it correctly configures just the laptop monitor. If you wanted to configure just the external monitor, you could run something like


disper -d CRT-0 -s
Use "disper -l" to find out the names of your attached displays.

All times are GMT -5. The time now is 10:53 PM.