How to disable and enable keyboard in ubuntu?
I have a great trouble because I don't have enough space to put both my keyboard
and some other things
on my desk. And accidentally pressing some key may cause trouble to the system. So I am looking for one way to lock my keyboard temporarily. Of course I don't want to plug out the keyboard from the computer because it is so inconvenient.
How can I do with this?
xinput -list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Optical Mouse id=9 [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)]
↳ Power Button id=7 [slave keyboard (3)]
↳ CHICONY HP Basic USB Keyboard id=8 [slave keyboard (3)]
↳ HP WMI hotkeys id=10 [slave keyboard (3)]
xinput --enable 9
xinput --disable 9
work the same as your command? – eccstartup Jul 28 '13 at 10:26mouse
. – eccstartup Jul 28 '13 at 10:29sleep 5
here is that, if you got the id wrong and disabled your working keyboard, it'll undo itself in a few seconds. My built-in laptop keyboard keeps spamming me with 'q', which causes any open app (usually Firefox) to quit if I press the ctrl key. So with this short script, I can disable the keyboard, then hit ctrl-c (on my working wireless keyboard) to stop it being re-enabled, but if I somehow used the wireless keyboard's id, the ctrl-c won't register, so the script will continue and re-enable the keyboard. – Desty Oct 28 '15 at 00:00