I want to start this post by saying that this is a pretty complicated side of tech. To give you an idea, what I did is strictly for Linux running X11. It also required knowledge of things like window managers, VNC protocol, and hardware acceleration wrapping. It was not an easy project, and admittedly, there are alternatives that are way simpler, albeit less customizable and/or less optimized in performace and quality.

So, what does my setup look like? This.

Sorry about the Wataten background. Actually, nevermind, I'm not sorry, I love that anime.

Okay, what the heck is this? There's different backgrounds, two pointers, and the one on the left isn't even the same window manager. You can't tell me that these two things can run on the same computer, and that's certainly not the same user, and I'm absolutely sure you don't use the same mouse and keyboard for these things.

They can, it is, and I do. Admittedly, the different window managers is not my choice; getting GNOME to work with this is a bitch and a half. I'm still figuring that out and I will. But other than that caveat, It's using the same computer, using the same user, and even using the same input. The only thing not supported yet is dragging windows between them, but honestly, I don't really need or want it. I like the idea of having these two screens separate in session but joined in input. How does the input switching work? Do I use a shortcut to switch screens? Do I have to use some sort of splitter for a USB keyboard and mouse? Am I using bluetooth peripherals? No, I literally just drag my mouse to the right. Mouse and keyboard now control the Android screen. To the left, back to the laptop screen.

Alright, so how do I get this working? Here's the secret: The tablet on the left is using a different X display. What does that even mean? When you use Ubuntu or Linux Mint or Manjaro or whatever distribution you prefer, you're likely launching an X server at startup. An X server, like Xorg and uh...Xorg, does something pretty interesting. See, the display isn't permanently linked to the operating system. If you've ever used MS-DOS, or been old enough to see what MS-DOS looks like, you'll remember that when you boot up your machine, you don't see a desktop. You get that scary white text on black background that everyone is paranoid will kill them in their sleep. You boot up the desktop with a special type of executable called graphics.com. When you execute this, you banish the white text into the shadow realm. Now you can use a mouse! Wow! How does that work? I wish I could tell you, but honestly, it's still kinda magic to me. On the low level, it probably has something to do with mapping bytes in memory to bytes in color. And some Voodoo magic. (Haha! Get it? Voodoo? I feel old!)

X servers pretty much do the same thing. When you boot, you don't get the graphics. In fact, you don't even get a terminal. You literally get a black screen, which I think is even scarier. A black void in which shouting at it provides an infinite echo of silence and dispair. But no worries! A proper X configuration will say, "Ah, we have awaken. Time to execute the MANAGER." Specifically, the desktop manager. Or the virtual terminal, depending on what you have set in your configuration. In order to properly manage this, X servers need a way to tell what you're looking at, because Linux can switch between different displays, and not the monitor kind of displays. If you're running a stock install of any Linux, the display name is usually :0. This post is already at 668 words right here, so let's just cut to the chase: X servers, when configured for it, can run multiple displays for multiple sessions of multiple users. So how do we run another display? How do we access it? We can do this through virtual network computing, or VNC for short.

I've tried a lot of different things. I tried TeamViewer. Easy to set up, but it required a virtual screen on my desktop. Virtual screens are not fun and weird and I don't like them. Get 'em out. I thought of using a remote desktop server. RDP doesn't require another screen, but requires another user. Not what I was looking for. I tried X11VNC after that. It worked! Same user, but I needed a virtual screen, disgusting, no thank you. I next tried TightVNC. It got closer to what I wanted, and I stuck with it for a while, but found that the performance was sub-optimal. I wasn't planning to do this consistently, but I wanted to run OpenGL applications on this second monitor. Can't do that with the stock TightVNC. What else can I do? Honestly, not a whole lot. Thankfully, I stumbled across the best solution I have so far; TurboVNC. It uses TightVNC for its backend, but modifies it to use something called VirtualGL, which does exactly what you'd expect. I now have a VNC solution that allows me to start a new display on the X server logged in the the same user I'm logged into now and do hardware-accelerated things at a framerate much higher than 2 FPS. Great! Now let's open this on my--oh.

Well, the server's great, but the client is garbage. This is starting to become a hassle.

I think I spent more time finding the right viewer than the right server. The huge problem with high performance VNC is that no matter how good your server is, you'll still be bottlenecked by your viewer. I must have spent three days searching for a good VNC client with hardware accelerated server support when I came across MultiVNC. They're current release at the time of posting this is pretty alright, gets the job done with standard TightVNC or RealVNC servers. But the beta...ooh, baby. Support for TurboVNC, support for hardware acceleration, sooooo many goodies. And despite the beta tag, it's actually very stable. I tested a few HW accelerated applications, and...it's actually very smooth. It's almost like it's not even a wireless tablet anymore.

Now here's where the current problem lies. Very nitpicky, but it's only natural I want the best for and from myself; I can't quite seem to get GNOME working correctly. Why? No idea, other than the slight question in my mind of, "Why is accessing anything GNOME related so locked to root and even GNOME itself? What reason does GNOME have for being so paranoid?" I'm sure at some point I can add an edit to this post explaining how "I figured it out I did the power brain move", but for now, I'm still trying to figure this out. The very peculiar thing is, GNOME actually works without VirtualGL. Something seems fishy here, and it's possible I'm just a few looks into config files from having my Eureka moment, but for now, this is where my journey ends.

Oh, before I forget; switching the user input from one display to another is not an integrated feature. But X2X is specifically designed for this, and literally takes no effort to set up other than typing:

x2x -[direction] -to :[display]

in the main display's desktop terminal.

This is clearly a lot of effort for an almost negligible use case. If you're okay with virtual screens, Teamviewer or Splashtop would be just fine. They run quite fast, and you don't have to change anything for hardware acceleration to work out of the box. I really put way too much effort into "just a second screen", but while beggars can't be choosers, I'm not a beggar. I'm a developer.