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.
3 Answers
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
-
Cool! Now I can plug the thin keyboard data cable back inside the laptop.– LenikCommented May 11, 2011 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.
-
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.– LenikCommented Nov 30, 2010 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.
-
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.– LenikCommented Dec 3, 2010 at 9:15