First thing that we need to accomplish is turning off mouse, but only in X. For this we could use xinput
.
We need to discover input devices that are connected to computer (to X server):
pbm@tauri ~ $ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ A4Tech USB Mouse id=10 [slave pointer (2)]
⎜ ↳ Macintosh mouse button emulation id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
[...]
Device that we need to use is A4Tech USB Mouse
with id=10
. Next we need to check properties of that device:
pbm@tauri ~ $ xinput list-props "A4Tech USB Mouse"
Device 'A4Tech USB Mouse':
Device Enabled (121): 1
[....]
To turn off device we need to change property Device Enabled
:
xinput set-prop DEV PROP STATE
xinput set-prop "A4Tech USB Mouse" "Device Enabled" 0
To turn it on:
xinput set-prop "A4Tech USB Mouse" "Device Enabled" 1
Next thing is to do it automatically... ;) In this example we will be disabling mouse by keyboard shortcut and enable it by pressing left + right mouse button.
For this we could use actkbd - keyboard (but not only) shortcut daemon that works outside of X server.
First we need to create empty configuration file for actkbd: touch /etc/actkbd.conf
. Next thing is to discover devices connected to computer:
pbm@tauri ~ $ cat /proc/bus/input/devices
I: Bus=0003 Vendor=046d Product=c312 Version=0110
N: Name="BTC USB Multimedia Keyboard"
P: Phys=usb-0000:00:1d.0-1.6/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6:1.0/input/input6
U: Uniq=
H: Handlers=kbd event3
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7
I: Bus=0003 Vendor=09da Product=000a Version=0110
N: Name="A4Tech USB Mouse"
P: Phys=usb-0000:00:1d.0-1.5/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/input/input8
U: Uniq=
H: Handlers=mouse1 event5
B: EV=17
B: KEY=ff0000 0 0 0 0
B: REL=343
B: MSC=10
[...]
In this part most interesting for use are names and handlers of keyboard and mouse devices.
First we handle turning off mouse by keyboard shortcut, so we need to discover key ids:
pbm@tauri ~ $ sudo actkbd -s -d /dev/input/event3
Keys: 29+41+42 //we need to press keys that will turn off mouse, 29+41+42 is Ctrl + Shift + `
When we know what are keys ids we need to put them to config file (/etc/actkbd.conf
):
29+41+42:::sudo -u pbm DISPLAY=:0 xinput set-prop "A4Tech USB Mouse" "Device Enabled" 0
To test it out we need to run actkbd
in daemon mode:
pbm@tauri ~ $ sudo actkbd -d /dev/input/event3 -D
In the same way we need to handle "turn on" event:
- Check handlers of mouse device
- Check key codes of left+right mouse button using
actkbd
- Put it to
actkbd.conf
- Run actkbd daemon to monitor mouse input device
Running daemons could be realized as init script or autorun script in environment.
To automatically turning mouse off we could monitor input device (cat /dev/input/event5
) and turn it off when there is no input...
I hope that my short intro will help you... ;)
I've had similar problems and found the answer on this blog to be fairly complete and have copied over the relevant details:
Set up palm detection:
Turn on palm detection, in a terminal type:
$ synclient PalmDetect=1
Set the maximum width that should be interpreted as a finger instead of a palm. I choose 4, most how-tos use 10, it's good to do a bit of guess and test here:
$ synclient PalmMinWidth=4
Then, set the minimum height of a palm vs a finger:
$ synclient PalmMinZ=50
Finally, under Ubuntu, 3 finger middle click is not enabled by default, so if you want to enable it use:
$ synclient TapButton2=3 TapButton3=2
In theory, this should enable 2 finger tap for middle click, and 3 finger tap for right click, but in Ubuntu 13.04 the resulting behavior is exactly the opposite. Therefore, if you prefer 2 finger tap for middle click use:
$ synclient TapButton2=2 TapButton3=3
To make this permanent once you have found the correct settings, save them into 50-synaptics.conf
which is located at /usr/share/X11/xorg.conf.d/50-synaptics.conf
in Debian/Ubuntu (Semplice) and at /etc/X11/xorg.conf.d/50-synaptics.conf
in Arch Linux based distros, (the first "InputClass" part is for the multi-touch middle click fix, which is already enabled in Arch so you shouldn't need to add it):
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
Option "HorizTwoFingerScroll" "on"
Option "VertTwoFingerScroll" "on"
EndSection
#synclient PalmDetect=1
Option "PalmDetect" "1"
#synclient PalmMinWidth=4
Option "PalmMinWidth" "4"
#synclient PalmMinZ=50
Option "PalmMinZ" "50"
Temporarily turning the touch-pad off while typing:
Instead of using synclient commands, use syndaemon:
$ syndaemon -K -i 0.5 -R -d
The arch wiki claims that if you save this command to your ~/.xinitrc
file to have it executed automatically at your next log-in. However, when I did this, I was unaware that the command must happen before the launch of the desktop (exec DESKTOP.session
command). After playing around with a ton of other config files and learning a ton about the SLiM display manager, I finally realized that the command just needed to be moved further up the file, as commands after the desktop launch won't be run until the desktop is quit.
Best Answer
This is a temporary "solution" that I created (same problem here):
Put this at the bottom of the .bashrc file in your homedir:
Now you can use
touchpadon
andtouchpadoff
to turn it on/off from a terminal. This works because it always searches for the right id first.It's pretty useless if you don't always have a terminal open, but I'm mentioning it because it helps me a bit (and I'm using until a better solution is available).
I would have placed this in a comment, where it actually belongs but the code is too long for this...