19

I have a system with a single monitor, I would like to test the an xmonad configuration that is designed for multiple monitors. Is there any way to emulate a system with 3 monitors using something like Xephyr to test my configuration?

lab_notes
  • 411
  • 3
  • 8

5 Answers5

12

I found the solution using Xephyr and Xdmx

First create the Xephyr displays

Xephyr -screen 1920x1080 -ac :1
Xephyr -screen 1920x1080 -ac :2
Xephyr -screen 1920x1080 -ac :3

This creates 3 windows 1920x1080, each of these will act as a monitor

Next add the xinerama layer onto these virtual displays

Xdmx +xinerama -xinput local -display :1 -display :2 -display :3 -ac :4

Next create a fresh terminal and start your window manager or application like so

DISPLAY=:4.0
xmonad

or if you just wanted to test an applications xinerama support instead of xmonad you could run xterm or thunar.

lab_notes
  • 411
  • 3
  • 8
  • I'm starting the screens like this `Xephyr +extension RANDR -screen 800x600 -ac :1&`, then the same with `:2`. After this, I try adding Xinerama like you do: `Xdmx +xinerama +extension RANDR -display :1 -display :2 -ac :3`. But then, `DISPLAY=:3 xrandr` complains: `RandR extension missing`. Does this work for you? – Gauthier Nov 10 '22 at 10:28
8

You only need a single instance of Xephyr.

Xephyr +xinerama -screen 1920x1080 -screen 1920x1080 -screen 1920x1080 -ac :1

If you need RANDR extension, add +extension RANDR args.

Xephyr +extension RANDR +xinerama -screen 1920x1080 -screen 1920x1080 -screen 1920x1080 -ac :1

EFernandes
  • 187
  • 1
  • 3
  • 1
    If I want a window manager say Xfwm4, to use all virtual displays? – user877329 Aug 04 '17 at 14:30
  • 4
    This doesn't actually work (though it doesn't crash.) You can verify by running `xrandr` under it and seeing that it only shows one monitor. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918457 seems to have some details – Frew Schmidt May 22 '19 at 23:46
1

This works for me:

Xephyr +xinerama +extension RANDR -screen 800x600+0+0 -screen 800x600+800+0 -ac :1

Although DISPLAY=:1 xrandr still returns only one screen, my C application calling XineramaQueryScreens(dpy, &new_num_mons); gives me the right geometry.

Gauthier
  • 1,225
  • 2
  • 17
  • 30
0

I don't know if this was possible back when the other answers were posted, but here's how you create a 2x2 grid with three virtual monitors occupying the top-left, top-right, and bottom-left quadrants, and a blank space in the bottom-right quadrant to mess with things that assume there's no dead space:

Xephyr +xinerama -screen 640x480 -origin 640,0 -screen 640x480 -origin 0,480 -screen 640x480 :1 &
ssokolow
  • 951
  • 10
  • 10
  • My version of Xephyr does not complain that it doesn't recognize the option `-origin`, but it does not honor it either: `DISPLAY=:1 xrandr` gives only one screen. Mind you, it says that `current` of Screen 0 (the only screen) is 1280x960, but the selected resolution is 640x480. It seems like Xephyr does not have an option `--version`. – Gauthier Nov 10 '22 at 10:17
-1

While this answers the question it is not a full-blown solution. These solutions place the three screens in a horizontal row (well, at least according to xinerama (xdpyinfo -ext XINERAMA -display :1), the actual window placement will be taken care of by the window manager). If you want to have any other placement of the screens this will not help.

uli42
  • 162
  • 3
  • Are you referring to other answers? It is not clear which ones you mean, and new answers may come after yours and not show in chronological order. This is not a forum thread, and your answer must stand on its own. – Gauthier Nov 10 '22 at 08:12
  • Back then I was not allowed to add comments, IIRC. So I had to post an answer. I think I was referring to the answer by @EFernandes – uli42 Nov 11 '22 at 12:38