March 21, 2019

Handling Multiple Displays with x2x - page 2

Two Displays, One Problem

  • September 27, 2005
  • By Rob Reilly

x2x is a standard application on the SUSE Linux 9.2 Professional DVD. Since my notebook is an AMD Athlon 64 the version I use is 1.30-beta-2x86_64. Versions are also available under Red Hat, Debian, Gentoo, and BSD. I installed the program with YAST.

The desktop is an old Pentium II machine with SUSE Linux 9.3 Professional installed. It's hooked up to the router using a CAT 5 cable. The notebook talks via a 802.11b link.

x2x can be executed at the command line or from a script. You can use any combination of laptops or desktops and don't necessarily have to mirror my example.

Starting and running x2x is pretty painless. In my case I used my laptop ( to control my desktop ( Here's how to make it happen.

The first task is to ssh into the desktop machine from the notebook. I created an rreilly account on each machine, with the same password, for convenience.

Next, I ran the following commands over the ssh login.

    rreilly-desktop> X -ac :0 &
    rreilly-desktop> /usr/X11R6/bin/kde
    rreilly-desktop> set DISPLAY
    rreilly-desktop> DISPLAY=; export DISPLAY

In this case, KDE then appeared on the desktop display and sat there waiting for input. GNOME, FVWM2, or xfce could just as well.

Then, it was an easy matter to start x2x in a laptop xterm:

    rreilly-laptop> x2x -west -to

Like magic, the mouse cursor could then be rolled back and forth between the laptop and the desktop screens. The "west" switch arranges the screens so that if you move off the laptop screen to the left, you'll see the cursor appear on the desktop monitor. Move back to the right (on the desktop screen) and the cursor will pop back to the laptop. The laptop keyboard and mouse controls both screens. The desktop mouse and keyboard are still usable.

To simplify startup, I put the desktop machine commands into a little script file called "headless." I probably should have called it "mousekeyboardless" or something. The file permissions were changed on the headless file to 744. Back at the first step, the file can then be executed in an xterm:

    rreilly-desktop> ./headless

Most Popular LinuxPlanet Stories