For the longest time I’ve been trying to get a triple head setup working (“triple head” referring to 3 monitors attached to one computer). This is a trivial feat if using Windows but for Linux users it can be a daunting task – especially if one of the monitors is powered by a DisplayLink device. Let me take a step back.
I was an avid Windows user for years but after using a Windows install for more than a couple of months you start to notice things slowing down and excessive cruft and garbage piling up until eventually you’re forced to re-format and re-install everything. Those weeks after the re-format are blissful – everything’s fast and responsive but slowly, over time, the cruft builds up again (or blue screens start occurring) and you eventually know you’ll need to re-format but dread having to do it. Not because it’s hard but because re-formatting on Windows takes ages – every program wants a system reboot and/or license key you don’t have; basically it just takes forever and is a lot of pain -> enter Linux.
I tried a couple distributions (“distros”) of Linux in my early Windows days – Mandrake & Slackware – mainly because it was “cool” at the time to do. I had no idea what I was doing and, in the case of Slackware, really had no idea what I was doing. At least Mandrake would drop you into a GUI from an install; Slackware on the other hand took you out on a boat to the middle of nowhere then dumped you in the water without a life vest. Also, back in those days doing anything on Linux [at least to me] was an epic and huge time-wasting chore. If you wanted something that wasn’t installed via the distro installer you would spend hours chasing down dependent libraries and compiling code and most likely end up failing or giving up. Plus, basic things you expected to work because they worked in Windows – like having sound & printing – were nowhere to be found on Linux (unless you had very specific hardware). And, there was no Google to help you find out why something wasn’t working! Anyway, today’s Linux is totally different; all the manual dependency chasing and compiling is gone and most things work out of the box and work quite well out of the box. Installs are fast and practically reboot free; plus you can queue up a ton of stuff to install and simply leave: hardly any user interaction is required (you aren’t clicking “next” or “ok” 20 million times). Ubuntu in particular has become wildly popular due to its ease of use and features offered (and it’s completely free).
I’ve been using Linux as my main operating system since the end of 2007 because I got tired of Windows always eventually failing and then having to waste tons of hours re-formatting and re-installing. However, my job as a programmer requires that I run Windows -> enter virtualization.
Virtualization programs like Workstation, Fusion, Parallels, VirtualBox, QEMU (and many others) let you run an entire operating system (or multiple entire operating systems) on your machine at one time. These OS’s running inside your current OS are called virtual machines. Each virtual machine (called a “guest”) is completely sandboxed from your main operating system (called the “host”) so that if a virtual machine crashes it doesn’t take down your whole system – you simply restart the virtual machine as if nothing had happened. You can also make “snapshots” of virtual machines so that if you end up messing one up you simply revert it back to an earlier point in time and again, it’s like nothing had happened. You can also let the virtual machine have access to devices on the host – typically USB peripherals – so that they now can be used inside the guest as well as the host.
Back to the modern day-ish.
I run Linux (and have been for a while) because of the stability and ease of use/maintenance. I then fire up a Windows virtual machine or two every day in VMware Workstation (or VMware Fusion on my laptop) to do my work. I had a working dual monitor setup on Linux (using NVIDIA + TwinView) and VMware Workstation could take over both monitors and give me a dual monitor Windows virtual machine (so that no screen space was wasted while working). This setup worked great for a while until I came across a spare monitor and, since I had the desk space, wanted to try and get a triple head system going. (Who wouldn’t? On Linux doing more than dual monitor typically requires that you add an extra video card to your system but I didn’t want to go this route.)
About this time I had come across DisplayLink – a technology that lets you attach extra monitors to your computer by simply plugging in a USB cable. The DisplayLink site offers drivers for Windows and Mac (although Mac support didn’t exist at the time of discovering this) but none for Linux. You can get DisplayLink devices working in Linux (search for my 3 blog posts on the subject) but it’s limited, tedious, and doesn’t seem to play well with other video card/monitor setups (at least in my case – proprietary NVIDIA driver combined with xf86-video-displaylink driver).
I spent many hours trying to get my DisplayLink device to work on Linux with my existing NVIDIA card and dual monitor setup but could never get things working. I was approaching things from the host OS side because I had tried previously to get the Windows virtual machine to use the DisplayLink device but had run into issues there. The tools for the virtual machine that let you bring the mouse in and out easily of the virtual machine window never get told that there’s an extra monitor so they don’t know that the screen bounds have changed and so you can’t ever move your mouse to the DisplayLink attached monitor when it’s attached inside the virtual machine. I couldn’t figure anything out on this front so I kept trying to get things working on the host side because if the host saw 3 monitors then the virtual machine tools would see 3 monitors and I’d have 3 monitors. But, as mentioned twice before already I couldn’t ever get my NVIDIA dual monitor setup to work with the displaylink X driver.
Back to today-ish.
It had been a while since I tried getting the DisplayLink device to work while attached inside the virtual machine so I decided to give it another shot. The mouse-not-being-able-to-move-to-the-added-screen issue is still there but I decided to search on the VMware forums as well since a couple versions of Workstation (& Fusion) have come out since I last tried this. I found a post with a novel idea: because Windows can see that another monitor is attached and it knows that the screen size is what it is why not attach the host OS’s mouse directly to the virtual machine and then, because the mouse isn’t going through the tools, the mouse can access all the screen space that Windows sees! This requires a configuration change in the virtual machine’s .vmx file and a reboot but now I have 3 screens accessible and usable (!) inside the virtual machine! There is some weirdness when trying to move the mouse from monitor 2 to 3 (presumably because the tools are still influencing things slightly) but it’s working good enough to ignore for the moment. I’m also using UltraMon to easily move things from monitor to monitor and be able to maximize programs across all (or a portion) of the desktop (like Visual Studio maximized across monitor 1 & 2 with Thunderbird on monitor 3) and things are going well.
This is the snippet that goes in the .vmx file for the virtual machine:
usb.generic.allowHID = “TRUE”
With this added you will now see your mouse/keyboard (and other devices) listed as devices that can be attached directly to the virtual machine. I connected a second mouse to the host and then attached my primary mouse to the virtual machine (note that the primary mouse can no longer interact with the host so that’s why I added the second mouse).