No Window on 2nd monitor with screen=1 (dual-head Linux)

Hi,

i have a dual-head 1920x1200 each (HDMI, DVI) setup running linux with “zaphodheads” in radeon as independent monitors.

If in Coder I define a visual.Window with option “screen=0” it works.
If I try “screen=1” I get a Warning: “Requested an unavailable screen number - using first available”.
Ok, Coder sees only a single monitor, the first.

But if I start the Coder on the second Monitor with

DISPLAY=:0.1 psychopyApp.py

then also here the window, no matter of screen number (same Warning as above if!=0), opens on first Monitor. While I would expect it to open on the same, that is the second monitor.

Also screen=10 or 11 does not work (the offset of xorg)

Please: How can I open the window on my second monitor?
Thanks a lot!

2 Likes

Hi, I don’t know if my reply will help you, but your message helped me figure out an issue of mine so I thought I’d chime in. I would also be interested in finding out if you ever made progress on this problem on your own, sometime in the past 30 days.

In my case, I was able to get our task running on the second monitor (with a similar display configuration to yours) with a line like:

DISPLAY=:1.1 python myTaskFile.py

In other words, I run the task directly without opening it in PsychoPy Coder first. And also, at least in our setup, the main display number was 1, not 0, although this is likely going to be different for different people. (We are on Ubuntu 16.04 and using an NVidia graphics card, but with a similar zaphodheads-style setup.)

It is worth noting that PsychoPy still only seems to be aware of a single monitor (i.e. whichever one matches what you have set the DISPLAY environment variable to) – our task doesn’t work with any screen number higher than 0. But as long as we set DISPLAY equal to the correct X display for our monitor, that is OK for our purposes.

Hope I was clear – let me know if any questions.

Cheers,
Matt

Hi Matt,

thanks a lot for your answer! Sorry for the delay, i had no access to the computer, but now.

Unfortunately your solution does not solve my issue, even starting from command line with
DISPLAY=:0.1 python
directly, the stimulus window does not appear on the 2nd screen (stimulus monitor), but always on the first (control monitor), no matter of screen=0 or 1 in win(). But, funny enough, the resulting graphics window, e.g. timing accuracy does show up on the second. Weird.

Any more ideas?

Best,
Uli

Same same on different machine with different graphics nouveau, Zaphodheads, DVI&HDMI.

I am also currently experiencing this issue - doesn’t matter what screen number was set (tested from 0 to 12), the window keeps appearing on the main screen. Anyone managed to resolve this yet?

I also have exactly the same issue. I cannot show stimuli on 2nd monitor in ubuntu. The ‘screen=1’ option gives the warning: “Requested an unavailable screen number - using first available”.

Further, the option “DISPLAY=:0.1 python mypsychopyscript.py” still shows stimuli only on 1st screen, though this only happens with psychopy code; e.g. if I use “DISPLAY=:0.1 xload”, this shows normally on 2nd monitor). I appreciate if anybody can offer a suggestion!

Thank you,
Dimitrios

I believe I have found a solution. I enabled Xinerama in my xorg.conf file:

Section “ServerLayout”
Identifier “Layout0”
Screen 0 “Screen0” 0 0
Screen 1 “Screen1” RightOf “Screen0”
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Mouse0” “CorePointer”
Option “Xinerama” “1”
EndSection

Hi Dimitrios,

thanks for trying!

But xinerama is not recommended at all in order to get proper
independent and accurate timing for the two monitors. Sorry.

Best,
Uli

Hi again,

I realized that downgrading from pyglet 1.3.x to 1.1.4 solves the problem! (without xinerama).

Best,
Dimitrios

I realise that this question is nearly 4 years old, but did you find a solution to this? I am having the same problem with psychopy 2021.1.3 (and downgrading pyglet didn’t work for me).

Thanks
Will

I am sorry, unfortunately not. I even cannot install psychopy anymore, I tried severval times meanwhile, but without any success. Psychopy insists in using the outdated libwebkitgtk in version 1 instead of the recent (and only available) Version libwebkit2gtk-4.0. Did you happen to succeed?

A little hope would be, that opening a second screen in pure glfw now works correctly in one recent setup for me. Which didn’t before, eventually being the show-stopper for psychopy?

I found that since pyglet v1.2 it is possible to specify which X11 display to use, see here

In psychopy/visual/backends/pygletbackend.py it is hardcoded as get_default_display(), it should be an easy fix to allow get_display(name) according to some keyword argument. I will try it when I am back in the office next week and let you know.

I install psychopy through anaconda since it ensures that all the dependencies are met (at least on my linux box).

Since an installation under Linux is working again (see installation-headaches-and-partly-fixes-on-ubuntu-20-04) I am happy to report, that with frontend winType="glfw" and screen=0 (or 1) I indeed can now chose between monitors, no matter which screen from the coder was called. And their refresh rates are as intended, according to output from timeByFrames. Verified on just one single test setup so far.

Just wondering if there’s any update from the PsychoPy devs on the topic of dual monitor support under Linux? This still seems to be not trivial, and I’d love to know if there are any roadmap plans for improving Linux support. I know of several labs (including my own) who would love to use more PsychoPy under Linux but are encountering these kinds of issues.

1 Like

Wondering the same. The screen handling under linux is really awful and I cannot figure out how to output to screen 1 which is placed in the experiment-room while seeing my code on screen 0 which is placed in a different room.

Meanwhile the 2nd screen opens up.
You need to consider

  1. not to use X11-Zaphodheads but a single desktop “xinerama” (which is most default)
  2. start with special combination of flags, and your resolution, e.g. namely:
    win = visual.Window([1920, 1080], screen=1, allowGUI=False, waitBlanking=True)
    we work like that since spring.

But yes, being able to access the full plethora of options would be nice …