Prevent X with ZaphodHeads from creating a :0.1 screen when monitor is disconnected

Dan Arena ddan39 at gmail.com
Thu Mar 26 15:09:39 UTC 2020


Good morning,

This is kind of an odd setup I am doing. I am usually using 2
monitors, and want separate X screens for each, so :0.0 and :0.1, but
if the 2nd monitor is not connected I do not want :0.1 to be created.
Up until now I have been using the nvidia driver, which by default has
an option "AllowEmptyInitialConfiguration" set to false, which
prevents the :0.1 from being created when the 2nd monitor is not
connected at startup. I would like to have this same behavior with the
intel or modesetting driver and ZaphodHeads. I am currently using the
intel driver on CentOS 7 since modesetting was tearing, but if need be
I can probably switch to modesetting and turn on some other options to
stop the tearing.

With the intel driver, if the 2nd monitor is disconnected, :0.1 is
still created and is just a 1024x768 framebuffer. The main problem
this is creating is the java application I am using still thinks there
are 2 "monitors" available. It uses
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
to determine the "number of monitors connected". The developer keeps
insisting that I fix my OS setup to report the proper number of
monitors connected. The 2nd monitor is used only for displaying a
video, which is why I want it on another X screen; this way the mouse
cannot move over there, and screenshots can be easily taken of each
monitor separate.

Any ideas?

Note, I am not using a DE, but just running startx with xinitrc that
starts a window manager (metacity).

Below is my current xorg.conf. I tried experimenting with a couple
other configurations, like removing all but the Device sections, and
turning on Option "ReprobeOutputs", with no luck. It either never
creates :0.1, or always does.

Thanks,
Dan

Section "Device"
    Identifier     "Videocard1"
    Driver         "intel"
    BusID           "PCI:0:2:0"
    Screen          0
    Option          "ZaphodHeads"   "HDMI1"
EndSection

Section "Device"
    Identifier     "Videocard2"
    Driver         "intel"
    BusID           "PCI:0:2:0"
    Screen          1
    Option          "ZaphodHeads"   "HDMI2"
EndSection

Section "Monitor"
    Identifier "HDMI1"
    Option "PreferredMode" "1920x1080"
EndSection

Section "Monitor"
    Identifier "HDMI2"
    Option "PreferredMode" "1920x1080"
EndSection

Section "Screen"
    Identifier     "screen1"
    Device         "Videocard1"
    Monitor        "HDMI1"
EndSection

Section "Screen"
    Identifier     "screen2"
    Device         "Videocard2"
    Monitor        "HDMI2"
EndSection

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen      0  "screen1"
    Screen      1  "screen2"
EndSection


More information about the xorg mailing list