
Some time ago I’ve got two monitors connected to my workstation at work.
I do not like using Xinerama, so I have, in X11 terminology,
two screens, :0.0 and :0.1.
It bugged me that I had to move the mouse cursor to switch between
the screens.
There must be a way to do it with keyboard, I thought.
Some googling revealed a wiki page about dual monitors setup,
which had a reference to a little C program, dualmouse.c
by David Antliff.
It worked fine if all I wanted to do was to switch from my current screen to “the other one”. But I also wanted to be able to do things like “switch to workplace 4 on screen 0”, and the program could not be used for that.
Fortunately, the wmctrl utility could do things
like “switch to workplace 4 on the current screen”,
so all I had to do is to modify the dualmouse.c program
to support “switch to screen N” functionality,
and the rest is, as they say, shell (or Perl) scripting.
The ~/.fluxbox/keys file (if you are using something else than
fluxbox, you are on your own here) would have things like:
Control F1 :Exec flux2workspace 0 1
Control F2 :Exec flux2workspace 0 2
Control F3 :Exec flux2workspace 0 3
Control F4 :Exec flux2workspace 0 4
Control Shift F1 :Exec flux2workspace 1 1
Control Shift F2 :Exec flux2workspace 1 2
Control Shift F3 :Exec flux2workspace 1 3
Control Shift F4 :Exec flux2workspace 1 4
And the flux2workspace script looks like this:
#! /usr/bin/perl -w
exit unless @ARGV == 2;
system("dualmouse $ARGV[0]");
$ARGV[1]--;
$ENV{DISPLAY} = ":0.$ARGV[0]";
system("wmctrl -s $ARGV[1]");
Next time: accomplishing the same feat with x2x-controlled displays.

I'm glad you found the dualmouse program useful. It may be possible to create a combination of dualmouse and wmctrl as a single program - email me if you have any ideas.
If you end up fixing x2x to add keyboard hotkey switching screens, don't hesitate to send patch to me :)
I thought about this since I've got the maintainership, but did not manage to find enough time to implement it.
Thanks.
dottedmag: so far I worked around x2x to make the switch work, using a combination of a tiny program I wrote that sends XTestFakeMotionEvent() - very originally named xmouse, wmctrl and some delays in the shell script. This approach also requires being able to ssh back and forth. It's ugly and slow, and I would love to see x2x being able to do it natively. Maybe I'll look at it if I get annoyed enough by how slow my solution is.