Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehdidc/1ce7a082a2ecf88673be4f0f8c274715 to your computer and use it in GitHub Desktop.
Save mehdidc/1ce7a082a2ecf88673be4f0f8c274715 to your computer and use it in GitHub Desktop.
disable-keyboard-on-boot-ubuntu
Disable Laptop Keyboard in Ubuntu
Taken From :- https://blog.hostonnet.com/laptop-keyboard-ubuntu
To disable laptop built in keyboard in Ubuntu, first you need to identify the device id for keyboard.
Now run xinput –list command to get list of all input devices
hostonnet@pc4:~$ xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=11 [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)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ HP Truevision HD id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
↳ HP WMI hotkeys id=12 [slave keyboard (3)]
↳ HP Wireless hotkeys id=13 [slave keyboard (3)]
hostonnet@pc4:~$
xinput command should be run as user that run the GUI (Ubuntu logged in user).
The one above list what we need is
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
The ID is 10.
To disable the keyboard, run
xinput set-int-prop 10 "Device Enabled" 8 0
To enable it, run
xinput set-int-prop 10 "Device Enabled" 8 1
Method 2: Disabling on Boot
Edit file /etc/default/grub
vi /etc/default/grub
Find
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Replace it with
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.nokbd"
Regenerate grub.cfg with
update-grub2
Reboot Laptop, Built in keyboard will be disabled by default. No need to run xinput command and manually disable each time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment