Bjorn Rudolfsson
Bjorn Rudolfsson

Reputation: 99

Starting virt-viewer with 2 displays

Is it possible to get virt-viewer to start up with 2 displays?

Background: we have a linux based retail system that typically runs on terminals with multiple displays. Basically as X starts up we detect how many displays are connected and configure our system based on that (i.e. we have a primary display which is always shown, and an optional secondary display which is shown on systems with 2 screens). For testing we run this system in a VM (libvirt spice/QEMU based) with spice-vdagent allowing us to open up 2 displays with virt-viewer and thus emulating the same setup as the real terminals.

The problem is that virt-viewer can't seem to start up with 2 displays, I always have to open the second display using the View->Displays menu once X has started. This causes a problem since the screen detection and configuration has already happened at this point (and since only 1 display was open the system only detected 1 screen).

The only workaround I've found so far is to open the second display and then restart X forcing reconfiguration, however I really would need the second display to be open from start so we can get a two screen system without any manual intervention.

Can this be done? One problem is that the second display can only be opened once spice-vdagent has started, and that can't start until X has started.

Upvotes: 5

Views: 13502

Answers (3)

Mr Matten
Mr Matten

Reputation: 356

If your guest is a Linux, you'll have to make sure the heads property is set to 2 in your xml under video tag. If you have access to virsh, you can do virsh edit [name on vm]. If you start it directly from the terminal you probably have to set it as a flag.

Upvotes: 1

Autumn
Autumn

Reputation: 3766

With virt-viewer 6.0 using spice, it automatically starts with as many displays as the guest has enabled at boot.

Caveats:

  • I have only tested this with an Ubuntu 17.10 host and Windows 7 guest
  • If you open the guest in another viewer that does not have multiple displays, like the stupid builtin viewer in virt-manager, the guest may (OK, will) automatically disable the non-connected displays. On next run, virt-viewer will correctly start with only one display.
  • virt-viewer sadly does not retain geometry from one run to the next, and does not appear to have a way to specify geometry on the commandline. Your window-manager may help.
  • Alternately, start virt-viewer with the "-f" option for full screen. Then it seems to automatically maximize each window to an appropriate display.

Upvotes: 0

Wouter Vandenneucker
Wouter Vandenneucker

Reputation: 253

It is possible as shown here: https://www.youtube.com/watch?v=UySlAfz7e7Q

However, I was out of luck trying this on Ubuntu though. My mouse would not work. Whenever I went to the second screen, it shooted back to the first one.

I believe this was because of Unity. On Fedora and other Gnome based systems it is supposed to run great.

Upvotes: 0

Related Questions