Perl 我们怎么能在ubuntu中有两个Usb鼠标,一个右手,另一个左手?

Perl 我们怎么能在ubuntu中有两个Usb鼠标,一个右手,另一个左手?,perl,ubuntu,mouse,Perl,Ubuntu,Mouse,我有两只老鼠,我想同时使用它们。 棘手的细节是我想要一个右手,另一个左手。这是twomice.pl脚本 #!/usr/bin/perl # print "Two Mice\n"; # one left-handed and the other right-handed: cool! # enter strings from command "xinput list" my $leftDevice = "Mouse"; my $rightDevice = "MOUSE"; my $left

我有两只老鼠,我想同时使用它们。
棘手的细节是我想要一个右手,另一个左手。

这是twomice.pl脚本

#!/usr/bin/perl

# print "Two Mice\n";
# one left-handed and the other right-handed: cool!

# enter strings from command "xinput list"
my $leftDevice  = "Mouse";
my $rightDevice = "MOUSE";

my $leftHandedOptions  = "1 2 3";
my $rightHandedOptions = "3 2 1";

my $infole = `/usr/bin/xinput list | grep $leftDevice`;
my $infori = `/usr/bin/xinput list | grep $rightDevice`;

my $beginPart = "id=";
my $endPart = "\t";
$infole =~ /$beginPart(.*?)$endPart/; $infole = $1;
$infori =~ /$beginPart(.*?)$endPart/; $infori = $1;

my $commandWords = "/usr/bin/xinput set-button-map";
my $leftMouseCfg = $commandWords . " " . $infole . " " . $leftHandedOptions; 
my $rightMouseCfg = $commandWords . " " . $infori . " " . 
$rightHandedOptions;

#print $leftMouseCfg . "\n";
#print $rightMouseCfg ."\n";

system($leftMouseCfg);
system($rightMouseCfg);

这有助于防止重复性应变损伤。当一个人感到右手疼痛时,他们会用左手,反之亦然。