Fake Xdmx

Having declared Xdmx dead in my last post, I wanted a solution better than just Synergy alone. What I've cooked up is fairly straight-forward and allows most of the functionality of Xdmx ... but unlike Xdmx, it actually works.

Again, we have two computers, and I'll call them "master" (the one with the horsepower to run multiple displays, this will also be where you use the keyboard and mouse) and "slave" (an old laptop - in my case, with an external display attached).

What You'll Need

  • LightDM set up as the login manager on slave (others may work, I haven't tested)
  • Synergy installed and configured (preferably securely) between master and slave. If needed, follow my Command Line Synergy instructions and test that synergy shares the screens as expected.
  • a lightweight Window Manager you like configured on master (you don't have to use it on master, but we're going to run it on slave ... you may be able to run your favourite desktop on slave from master, but that's for you to experiment with later). I prefer Openbox.
  • xterm installed on slave. Almost any terminal emulator will probably work, but you'll need to substitute your term of choice whenever you see "xterm" below.

Process

Boot up slave (I'm assuming master is already running). Create a new file on slave:

# /usr/share/xsessions/xterm.desktop
[Desktop Entry]
Name=xterm
Comment=X terminal for the most basic X experience
Exec=/usr/bin/xterm

Essentially, we're making xterm a Window Manager. It's not well equipped to be a Window Manager, but that's not what we're trying to achieve here.

Log out, change your session to the new "xterm" entry, and log back in. Yup, it's horrible. You'll have a single xterm in the upper left corner of your monitor, and you can only use it if the mouse cursor is inside it. We're going to fix that. I would strongly encourage you to type xterm & twice: while both will be positioned exactly where the current xterm is, you'll have a use for them later. Now, type ssh -X you@master (substitute and appropriate username and hostname). Once you're logged in, type exec openbox. This will cause 'openbox' to take over the 'xterm' process and run on slave. So now you have managed windows, and if you right-click on slave's desktop you'll get master's Openbox menu and any applications you run will be handled by master.

Don't EVER kill the xterm you ran 'openbox' in: it's now the controlling terminal for the entire window manager, and killing it will terminate your Window Manager session.

But that's not all! Remember those two other terminals I recommended you run? They're still there, connected to slave. Let's connect Synergy in one of them. This is the same as my "Command Line Synergy" Tutorial, linked above:

$ ssh -f -N -L 24800:master:24800 master

I have to admit my local machine DNS management isn't good enough that I can use machine names: I use the IP address for "<master>" in the invocation above. Once you've authenticated, the prompt should return on slave: now type in this:

$ synergyc localhost

At this point, you should have Synergy running between the two hosts, and all applications that you run through the window manager menu system on slave will be run from master. I'm not getting shared clipboard (this is a Synergy problem) and I can't drag windows from master to slave (that's the major win that Xdmx offered). But for the most part ... it's pretty great.

You may have noticed that I didn't make use of that third xterm/terminal on slave. This is intentional: the other two are locked up by Synergy and Openbox respectively, but this allows us to still run applications off slave if we want to.

POSSIBLE IMPROVEMENT: I seem to recall there's a way to open an SSH session with port forwarding and connect at the same time, so there may be some way to have only one incapacitated terminal. But I'm pretty happy with this as it is.