Display Enviromnent Variable

Hi, I want to specify the display in which an application is supposed to run.
Right now my Display variable is set to :0 even though i have two monitors.
Im using an NViDIA 570 card with the proprietary drivers.

I want my display variable(s) to be set on :0.0 and :0.1
I’ve googled and searched the forums but couldn’t find anything helpful.

Running it like this should work:

DISPLAY=:0.0 my_app

Or run “export DISPLAY=:0.0” before starting the program (in the same shell).

KDE/Qt applications also take the “–display” command line option, others may have a similar option.

I have no experience with Multidisplay setups though, so I’m not sure if it works.

Are you sure there are two separate displays :0.0 and :0.1?
If you use something like TwinView, the two monitors are seen as one display by X AFAIK.

Thank you for your answer. I’ve tried running it with these arguments before, but they don’t work because my two monitors are configured as one display.
I hope I’m not mixing things so I try to explain how I want it to be.
I want to have two seperate displays (or are they called screens?) one for each monitor.

I tried parsing the --display arguments, which sadly didn’t work either.
The programs I use it for don’t have an option to specify the display it should be using.
I am pretty sure I use TwinView.

Well, that’s what I said.

As I wrote, I have no experience with multi-monitor setups.
But I think in the case of “TwinView” the driver presents both monitors as one bigger display to X.
From nvidia’s README file (see below for a link):

A single X screen is used. The NVIDIA driver conceals all information about multiple display devices from the X server; as far as X is concerned, there is only one screen

So maybe you could choose the monitor by setting corresponding X/Y values?

Which Desktop Environment are you using?
In KDE you could force windows to specific screens or coordinates by so-called “window rules”.
Just right-click on a window’s titlebar and choose “More Actions”->“Special Settings for this application” (or “Special Settings for this window”).
(might be named slightly different, my desktop runs in german language)

I would think KDE is aware of the two screens, as it has to display the panel on both of them.

For more information about TwinView, see the nvidia driver’s README files, especially the last section with Frequently Asked Questions:
ftp://download.nvidia.com/XFree86/Linux-x86/331.89/README/configtwinview.html
(this also tells you how you would set up your monitors as separate X screens)

Well, that’s what I said.

I don’t really know how i got that wrong. Sorry.

Which Desktop Environment are you using?

I’m using KDE. It if matters im using the KDE:Current repository.

I would think KDE is aware of the two screens, as it has to display the panel on both of them.

For more information about TwinView, see the nvidia driver’s README files, especially the last section with Frequently Asked Questions:
ftp://download.nvidia.com/XFree86/Li…gtwinview.html
(this also tells you how you would set up your monitors as separate X screens)

I created a configuration file using nvidia-settings and placed it in /etc/X11/xorg.conf.d/10-nvidia.conf.
Even after a few tweaks it still doesn’t work.

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 331.89  (buildmeister@swio-display-x64-rhel04-18)  Tue Jul  1 12:08:08 PDT 2014

Section "InputDevice"
    # generated from data in "/etc/sysconfig/mouse"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "IMPS/2"
    Option         "Device" "/dev/input/mice"
    Option         "Emulate3Buttons" "yes"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Samsung S27A750D"
    HorizSync       26.0 - 81.0
    VertRefresh     24.0 - 75.0
    Option         "DPMS"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Ancor Communications Inc ASUS VE278"
    HorizSync       24.0 - 92.0
    VertRefresh     50.0 - 85.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 570"
    BusID          "PCI:5:0:0"
    Screen          0
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 570"
    BusID          "PCI:5:0:0"
    Screen          1
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "HDMI-0: nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "DVI-I-3: nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 1920 0
    Screen      1  "Screen1" LeftOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "1"
EndSection

Section "Extensions"
    Option         "Composite" "Disable"
EndSection


Thank you again for your help.

KDE is probably overriding that setting. Did you re configure in KDE?

Note that even with a single screen you can have an app start on either screen as Wolfi said.

So I’m still trying to figure out what you want to do. If you just want an app to start on a second screen set its special settings. Right click the title bar select More actions - Special Window settings.

Then you could try to setup a window rule to force certain windows on specific screens as mentioned.
As this is a feature of the window manager itself (KWin), is also works with non-KDE applications.

I created a configuration file using nvidia-settings and placed it in /etc/X11/xorg.conf.d/10-nvidia.conf.
Even after a few tweaks it still doesn’t work.

Well, the file you posted is a full xorg.conf, so you should move it to /etc/X11/xorg.conf .

And if it still has no effect, try to disable the “KScreen 2” service in Configure Desktop->Startup and Shutdown->Service Management.
KScreen overrides any Xorg configuration (especially when using more than one monitor), as gogalthorp indicated.

KDE is probably overriding that setting. Did you re configure in KDE?

I could not reconfigure it as I’ve found out that the Service Manager isn’t able to run with two Xorg Screens running. After a bit of searching it turns out that is a common bug.

So I’m still trying to figure out what you want to do. If you just want an app to start on a second screen set its special settings. Right click the title bar select More actions - Special Window settings.

If you really want to know what im trying to do here it is:

function shuffle(){
    vlc --random --fullscreen ~/Speedruns\&  //On display 1
    vlc --random --fullscreen ~/TAS\    //On display 2
}

Well, the file you posted is a full xorg.conf, so you should move it to /etc/X11/xorg.conf .

I’m not 100% sure, but I think both options work.

As it turns out, steam games (Valve games in particular) don’t work with two X Screens, so I’ve gone back to TwinView for the time beeing.
Thank you very much for your help, even though I am not able to continue using two seperate X Screens I’ve learnt a lot :slight_smile:

What “Service Manager” are you referring to here? The one in KDE’s systemsettings, that’s called “Service Management”?
And I don’t see why this shouldn’t be able to run with two Xorg screens. Can you point to a bug report?

Try running it with “kcmshell4 kcmkded”. Does it work then?

If you really want to know what im trying to do here it is:

So you want to run the same program (VLC) on each of the screen alternatively?

Well, you could create window rules that filter by the window title. The VLC windows should have different window titles according to what file/directory you are playing.
OTOH, I’m not sure whether the “–fullscreen” option actually works like you intend with TwinView. It might span the fullscreen window over both monitors. Does it?

I’ve already given up on trying to run it with two Xorg screens, works flawlessly with one.

Yes

That’s an excellent idea, i’ll try that, thanks!
–fullscreen spans a window over one monitor only.

Instead of trying to do it “The old way” by command line,
If you’re running KDE, it’s probably easier to simply use the KDE settings to specify the configuration of your two monitors, then launch each VNC map and then move each to the desired display.

Unless you’re remoting into your machine, using the KDE tools should be sufficient and easier.

IMO,
TSU