The purpose of this tutorial is to aid starting a separate X session with a dedicated mouse and keyboard on demand (ie without needing a restart of X nor the computer).
When finished, you will have launched a new GNOME user session in a nested X window in which one mouse and one keyboard operates independently from the underlying session. The underlying session's mouse and keyboard can control also this 2nd session if necessary.
This comes in very handy when you have one or more friends over and you'd like to work on the computer on the same time but independently from each other.
Big thanks to Jori Liesenborgs that wrote Xevdevserver which makes this possible without patching X as well as for writing the original tutorial on how to accomplish multiseat using Xgl !
Ok, here we go:
The 1st seat - Refers to your ordinary X session - the one you logged in with when starting your computer.
Multiseat - The virtual seats running in nested windows with a dedicated pair of mouse and keyboard.
We are going to launch the Multiseats in separate windows, so if you want them to appear on a different monitor than the one belonging to the 1st seat - you better first get an extended desktop configuration working. That is beyond the scope of this tutorial, so look into a tutorial on xrandr for this.
Then, before we continue, be sure to plug in all mice and keyboards that we are going to use. You need at least one pair per multiseat. Usually, only the 1st seat can use the built-in keyboard and touchpad of laptops.
Lastly preparation-wise - I recommend you to add a second user to your system. I have had bad experiences with gnome panel icons disappearing after logged in with the same user in more than one session.
1. Get and install the necessary software
I had problems trying to accomplish this using Xnest, mainly with the cursor not showing in the multiseats. Using Xgl's software cursor, this was no longer a problem. Also, Xgl could provide support for direct rendering for the multiseats (dependant of graphics card - works with ATI cards? - and configuration).
Install the xserver-xgl package (along with Dbus in case it is not installed) using Synaptic or by running the following in a terminal:
Now, you may not want Xgl to be enabled for your original session (at least I don't). To disable Xgl for the current user, execute the following:
sudo apt-get install xserver-xgl dbus-x11
mkdir -p ~/.config/xserver-xgl/
The backbone in the multiseat setup is the ability to assign a mouse and keyboard to each multiseat. Jori Liesenborgs has developed Xevdevserver, a program that launches in the background and accomplishes just that. Thanks Jori!
First, download the tar.gz for XevdevServer from http://research.edm.uhasselt.be/~jor...c.XevdevServer
Then, install build dependencies:
Finally, extract the XevdevServer archive and execute to following in the extracted directory:
sudo apt-get install libx11-dev libxtst-dev gizmod libncurses5-dev
sudo make install
Previous versions of this guide had a fairly complicated step regarding how to detect and assign a mouse and keyboard to your 2nd seat. This script automates this process.
Save the following shell-script as "detect-and-assign-multiseat-mouse-and-keyboard.sh"
Now, put it somewhere in your PATH (eg /usr/local/bin/) and make it executable:
# Detects a mouse and keyboard and assigns these devices
# to a target DISPLAY (using xevdevserver)
# In addition to xevdevserver, you will need "gizmod" installed:
# sudo apt-get install gizmod
# Acknowledements and version history:
# v20080320 - Fredrik Wollsén
# License GPL v3
# Feel free to provide feedback on this script here:
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Make sure that gizmod is available
if [ ! -x `which gizmod` ] ; then
echo "You need to have gizmod installed for device detection to work";
echo "Please install gizmod (sudo apt-get install gizmod) and re-run this script";
TMP_FILE=`mktemp -t gizmod.XXXXXX`
echo "Usage: $BN TARGET_DISPLAY"
echo "For instance: $BN :1 if the devices are to be assigned to display :1"
if [ "$1" == "" ] ; then
echo No TARGET_DISPLAY argument was supplied
while [ $COUNTER -lt 10 ]; do
echo \n\n\n\n\n\n\n\n\n\n\n\n > $TMP_FILE
#echo The counter is $COUNTER
DEVICE_CANDIDATE=`cat $TMP_FILE | tail -n 10 | grep /dev/input | tail -n 1 | sed -r 's/[^\/]*(\/dev\/input[^ ]*).*/\1/g'`
if [ -a "$DEVICE_CANDIDATE" ] ; then
if [ ! -d "$DEVICE_CANDIDATE" ] ; then
if [ "$DEVICE_CANDIDATE" == "$MOUSE" ] ; then
echo "The keyboard device cannot be the same as the mouse device... Keep pressing that keyboard"
echo "Error: Could not detect any device within 10 seconds. Make sure you connected the device and try to run this script again"
echo "Starting device detection application in background... "
sudo bash -c "gizmod -g > $TMP_FILE &" || exit 1
echo "Move and/or press a button or two on the mouse that you will use for the 2nd multiseat"
if [ "$MOUSE" == "" ] ; then
echo "Device detected!"
echo "Now for the next few seconds, stroke a couple of keys on the keyboard that you will use for the 2nd multiseat"
if [ "$KEYBOARD" == "" ] ; then
echo "Device detected!"
echo -n "Shutting down detection application... "
sudo killall gizmod -s 9
echo "Done with detection!"
# export KEYBOARD
# export MOUSE
echo MOUSE and KEYBOARD variables populated as follows:
echo MOUSE = $MOUSE
echo KEYBOARD = $KEYBOARD
echo -n "Assign these devices to display $TARGET_DISPLAY? [Y/n]"
if [ ! "$ANS" == "n" ] ; then
DISPLAY=$TARGET_DISPLAY sudo `which xevdevserver` -fork -d $TARGET_DISPLAY -k $KEYBOARD -m $MOUSE
echo "Script finished."
2. Launch that 2nd seat
sudo cp detect-and-assign-multiseat-mouse-and-keyboard.sh /usr/local/bin/
sudo chmod +x /usr/local/bin/detect-and-assign-multiseat-mouse-and-keyboard.sh
First, we start a terminal (gnome-terminal, konsole or similar) in our main seat and set the variables that we will use. Be sure to replace the variables with your own values.
Then, we launch the following ONE-AT-A-TIME:
# Any unused X display number...
# The username that is to use the 2nd seat
# The parameter to decide the geometry of the X window. Tip: Use an empty value here while testing as fullscreen can be hard to get out from!
# Launches a GNOME session. I don't know the command to correctly launch KDE atm
export SEAT2_SESSION="dbus-launch --exit-with-session gnome-session"
# Adjust to your keyboardmap. Use "us" for US keyboards
# Save the current display variable for later use
Now move that X window to an appropriate place on the desktop so that the second user can see it and use it
# Launch the Xgl server in a window
DISPLAY=$MAIN_DISPLAY sudo /usr/bin/Xgl -dpi 86 -ac -accel glx:pbuffer -accel xv:pbuffer -softcursor $SEAT2_GEOMETRY :1.0 &
# A window with checkers and a cross-symbol for the mouse should display.
# Detect and assign mouse and keyboard:
# Now, your designated mouse should only be able to move the mouse within the window
# Switch to the desired user
sudo su $SEAT2_USER
# Launch the session
DISPLAY=$SEAT2_DISPLAY exec $SEAT2_SESSION &
# Wait until you are logged in...
# I find the following commands solving some issues with how the keyboard is interpreted - they may or not be needed for your setup.
# NOTE: If you experience troubles when issuing these, use a new separate terminal to issue them
# Set keyboard map (which often gets set erreneously) - ignore eventual errors from "The XKEYBOARD keymap compiler". If the keyboard seems stuck on some key, try pressing various keys from all connected keyboards until it stops... hopefully
# Re-enable Autorepeat (I found it was off after launching the 2nd seat...)
DISPLAY=$MAIN_DISPLAY xset r on
DISPLAY=$SEAT2_DISPLAY xset r on
After ending your multiseat, you may want to make sure xevdevserver is shut down (to be able to use your devices normally again):
That should be it! Enjoy your multiseat setup!
sudo killall xevdevserver
Some last notes
Even if this tutorial only instruct how to set-up that 2nd multiseat, you can use similar instructions to set up a 3rd and 4th seat etc. The actual amount of useable multiseats you can configure depends on the amount of mouse/keyboard-pairs you have and how many monitors you can connect to your computer (and extend your desktop to) versus how many users are willing to share monitors.
There are probably many other ways to accomplish this, and most likely ways to do more exotic setups etc. This is merely the result of one man's nightly fiddling that resulted in the above method and have not been tested currently by anyone else that I am aware of. That said - please don't be surprised if this doesn't work for you right away...
I'd love to hear how this works for you!
UPDATE 20-mar-2008 13:55: Added a shell script that automates the mouse and keyboard detection and assignment - no need for figuring out the correct device paths any longer: mouse and keyboard is detected by simply moving/pressing buttons/keys on each device.
UPDATE 27-maj-2008 19:10: Updated guide according to mayeulk's feedback. Thanks!