我们如何才能在ubuntu中拥有两只Usb鼠标,一只是右手,另一只是左撇子?

时间:2017-06-18 00:55:07

标签: perl ubuntu mouse

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

1 个答案:

答案 0 :(得分:-1)

这是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);