My cat likes to sleep on my keyboard on my laptop. It used to cause problems but I have a solution now.
My laptop is on a computer desk and I use a usb keyboard and mouse and not the built in stuff. The keyboard and mouse I use are on a slider that goes under the desk when I'm not using the computer, typical setup. Since I usually leave my laptop running to seed and media serve and what not, my cat sleeping on it was an issue. There is a simple fix for it though. You can disable them in linux vvia xinput.
First you need to find out what they are listed as by using xinput list
Example:
[techb@arch ~]$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ MOSART Semi. 2.4G RF Keyboard & Mouse id=10 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ MOSART Semi. 2.4G RF Keyboard & Mouse id=9 [slave keyboard (3)]
↳ HP Webcam-101 id=11 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ HP WMI hotkeys id=14 [slave keyboard (3)]
As you can see the things I want to disable are id=12 and id=13; AT Translated Set 2 keyboard and SynPS/2 Synaptics TouchPad respectively. To do this, we simply put them in a floating state using xinput float 12
and xinput float 13
.
Afterward they will not effect anything if they are pressed or used. To gain use again, we reattach them to the respected masters.You can see the id of the pointer and keyboard master in the `xinput list` output. xinput reattach 12 3 && xinput reattach 13 2
A simple python script to do this with just a single command, I only ever need to disable them, so reattaching is left out, feel free to add it. Also, a simple bash script or similar could just as easy do the same thing.
Make a file in /usr/bin and call it what you want, I call mine disablekey, add the following and chmod it for execution.
#!/usr/bin/env python2
import os
os.system("xinput float 13 && xinput float 12")