Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
19
rated 0 times [  19] [ 0]  / answers: 1 / hits: 30745  / 3 Years ago, sun, may 16, 2021, 10:50:58

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)]

More From » keyboard

 Answers
2

To Disable/Enable the keyboard, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:



xinput -list


enter image description here



Once you find your ID, then



sleep 0.1 ; xinput set-prop 9 'Device Enabled' 0 ; sleep 5 ; xinput set-prop 9 'Device Enabled' 1


sleep 5 is the number of seconds (I guess) you want the keyboard to be disabled.



For more information on the xinput command see the ManPage.



Or you can use Lock keyboard utility.


[#30171] Monday, May 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
repend

Total Points: 195
Total Questions: 113
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
3 Years ago
repend questions
Thu, May 11, 23, 09:38, 1 Year ago
Thu, Jan 5, 23, 21:41, 1 Year ago
Mon, Nov 22, 21, 19:37, 2 Years ago
Mon, Jan 24, 22, 11:26, 2 Years ago
;