I have connected an external USB keyboard, and I would like to lock the laptop keyboard so I can put a book on top of it.

link|improve this question

feedback

3 Answers

up vote 2 down vote accepted

On modern systems, you enable and disable devices via the XInput2 system. The quickest way to access that is via the xinput command.

If it's not already installed on Debian (Gentoo needs emerge x11-apps/xinput), do so. Then use it like this:

$ xinput list
[list which reveals my main keyboard to have id=10]
$ xinput set-prop 10 "Device Enabled" 0

You may want to do your initial testing using a command like this though, just to make sure that any problems are guaranteed to undo themselves after 5 seconds.

$ xinput set-prop 10 "Device Enabled" 0; sleep 5; xinput set-prop 10 "Device Enabled" 1
link|improve this answer
Cool! Now I can plug the thin keyboard data cable back inside the laptop. – Xie Jilei May 11 '11 at 3:45
feedback

Covering the keyboard of a working laptop is not a good idea because some of the air flows through the keyboard. I managed to broke a HP laptop years ago when I left it for a long compilation with laptop lid closed.

link|improve this answer
Thank you for your advice, though. It's also not a good idea to leave the keyboard open, because some small insects such as tiny ants and acarids will accidenty move inside. – Xie Jilei Nov 30 '10 at 7:42
feedback

Not really sure how to lock one keyboard and leave the other, but the hack'ish way is to run xev, it will steal all the keyboard's input until you specifically close it or move the input to another window.

link|improve this answer
No, this don't work because I do use an external USB keyboard at the same time. If run xev, it will eat all key strokes. – Xie Jilei Dec 3 '10 at 9:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.