Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is this possible?

Normally I use disper to enable my external monitor, but I don't think I can force the 2nd monitor to be primary.

I've played around with nv-control-dpy included in the nvidia-control source, but I haven't figured out how to do it yet. How to get:


This is a laptop, to which I connect an external hdmi display when I get to work. dipser -e extends the desktop for me, but the laptop remains the primary desktop (holding the panels etc). nvidia-settings can set primary monitor for me, but I want to use the cli.

share|improve this question
what's the hardware here? laptop with external monitor? two monitors connected to one GPU? two GPUs? – quack quixote Apr 16 '10 at 9:35
nvidia binary drivers...enough said. This would probably be really easy with xrandr, but the nvidia drivers only support their proprietary twinview. – Broam Apr 16 '10 at 13:35

4 Answers 4

up vote 3 down vote accepted

I succeed to exactly do what you mean, maybe because I have the 2.3 version, on ubuntu 10.04 with nvidia-setting v 1.0

Following The Bug Fix:

this has been listed as a big once :

by version 2.1 should work as you asked on 20010-04 and the 'bug fix' was confirmed on 2009-02-16

What I Had

by using:

disper -l

there I saw my devices were:

  • DFP-0: LGD (laptop display)
  • CRT-0: Samsung SyncMaster (external monitor)

(the external device doesn't show up by querying with xrandr)

What I Wanted and How

The laptop is on the right and the monitor is on the left, i wanted the laptop to be extended from the Samsung, thus, having the laptop physically top aligned, I wanted them to be also logically top aligned and have theyr own maxymum resolution:

disper -d CRT-0,DFP-0 -r auto -e -t right

this has to be read as: (-d) opertate first on SyncMaster then on laptop lcd, (-r) consider auto resolution, (-e) extend the second dysplay [second here is laptop because the -d set display ordering], (-t) extend the second display [laptop] to the right of the first.

Google Properly and Try First

Very Simple no nvidia-hacking needed. Hope it helps.



share|improve this answer
PERFECT! Thanks :) v 2.3 did exactly what I wanted. – Joernsn May 2 '11 at 15:31

I hacked the nvidia-settings source, and got a working solution:

This is done in Ubuntu, but porting it shouldn't be hard.

Run these commands:

sudo apt-get build-dep nvidia-settings
apt-get source nvidia-settings
cd nvidia-settings-195.36.08/src

Edit "nvidia-settings.c", and replace main() with this:

int main(int argc, char **argv)

    ConfigProperties conf;
    ParsedAttribute *p; 
    CtrlHandles *h; 
    char * target;

    /* initialize the parsed attribute list */

    p = nv_parsed_attribute_init();

    /* initialize the ConfigProperties */


    /* allocate the CtrlHandles for this X screen */

    h = nv_alloc_ctrl_handles(":0.0");

    if (!h || !h->dpy) {
        return 1;

    /* Get target from command line */
    if(argc != 2){ 
            printf("Usage: %s PRIMARY_DISPLAY\n", argv[0]);
        printf("Example: %s  DFP-1\n");
        return 1;

    target = argv[1];

    int i;
    for (i = 0; i < h->targets[X_SCREEN_TARGET].n; i++) {
        if (h->targets[X_SCREEN_TARGET].t[i].h) {

            printf("Setting primary display: %s\n", target);

            NvCtrlSetStringAttribute(h->targets[X_SCREEN_TARGET].t[i].h, NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER, target, NULL);


    return 0;

} /* main() */


cd ..

put the binary in path:

sudo cp nvidia-settings /usr/local/bin/setPrimaryDisplay

use it:

setPrimaryDisplay DFP-1
gnome-panel --replace 2>/dev/null &

Where DFP-1 is the name of the desired diaplay display. Gnome panel doesn't keep up with the times, and needs to be restarted.

You can download my binary compiled for amd64 here:

share|improve this answer

May be too obvious and an option you prefer not to use, but, what about changing which is the primary one at BIOS ?

share|improve this answer
The external is only connected about half the times i boot, so that'd be more work than using nvidia-settins gui. In fact, I never actually boot this computer, its just suspended. – Joernsn Apr 16 '10 at 13:10

You can try messing with xrandr. commandlinefu have great collection of xrandr-based scripts.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.