Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 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
share|improve this answer
Cool! Now I can plug the thin keyboard data cable back inside the laptop. – Xiè Jìléi May 11 '11 at 3:45

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.

share|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. – Xiè Jìléi Nov 30 '10 at 7:42

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.

share|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. – Xiè Jìléi Dec 3 '10 at 9:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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