Introduction
Introduction Statistics Contact Development Disclaimer Help
multinput (Multiple mouse/keyboard input with xinput)
Sunday Dec 2 7:41:31 2012
------------------------------
I have got a dual head main desktop. I always thought it would be
nice to be able to use several keyboards and mice working
independently. Today I learnt how to easily configure multiple input
with xinput only to discover that my settings will always disappear
after every reboot or logout.
Well, the logical next step was to write an script to automatically
activate multiple input but since I also want to be able to
deactivate it at will I wrote two parts "start" and "stop". So the
usage goes:
$ multinput start
or
$ multinput stop
or
$ multinput restart
The script can either be run automatically at startup (anacron comes
to mind) or manually.
Note: Be warned that this script is for personal use only. Feel free
to adapt it to your own needs. I hope you like it and that it is
useful for you too.
Here it is:
#!/bin/sh
set -e
# Script for personal use, to set multiple mouse/keyboard input
# It uses xinput, so read its man page for more info. In order to
# list your devices type "xinput list"
MOUSE2="PIXART USB OPTICAL MOUSE"
KEYBOARD2="AT Translated Set 2 keyboard"
usage ()
{
echo "Type 'multinput start' to use multiple mice/keyboards."
echo "Type 'multinput stop' to stop using multiple mice/keyboards."
}
start ()
{
xinput create-master multinput
xinput reattach "$MOUSE2" "multinput pointer"
xinput reattach "$KEYBOARD2" "multinput keyboard"
}
# Leave devices floating
stop ()
{
xinput remove-master "multinput pointer"
}
if [ "$1" = "start" ]
then
start
exit
elif [ "$1" = "stop" ]
then
stop
exit
elif [ "$1" = "restart" ]
then
stop
start
exit
else
usage
fi
______________________________________________________________________
Gophered by Gophernicus/1.6 on NetBSD/amd64 9.1
You are viewing proxied material from sdfeu.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.