A week ago, I spilt the contents of my cup onto my laptop keyboard. Half of the keys no longer work, except one! The letter Q which is very active regularly.
This is very disturbing as I work.
Is there a way to disable the internal keyboard of a laptop?
Is it possible with xmodmap
?
You can use
xinput
to float the input device under X.xinput list
to list your input devices.AT Translated Set 2 keyboard
and take note of itsid
number; this will be used to disable the keyboard. Also, take note of the number at the end,[slave keyboard (#)]
; this is the id number of themaster
, which will be used to re-enable your keyboard.xinput float <id#>
, where<id#>
is your keyboard's id number. For example, if theid
was10
, then the command would bexinput float 10
.xinput reattach <id#> <master#>
, wheremaster
is that second number we noted down. So if the number was3
, you would doxinput reattach 10 3
.Here's a demonstration:
Here is a little switch button to enable and disable a specific keyboard.
First, you have to find your keyboard id with
xinput
orxinput-list
.Bash script to enable/disable keyboard
Configuration
Icon
as the path of icon to display when enabling (for instance,/home/user/path/icon.png
)Icoff
as the path of the icon to display when disablingI used the following icons :
id
as the keyboard id (found it withxinput
)fconfig
path to config file. Change if you want to create configuration file in another directoryDon't try to run the script if you can't run it again without the use of your keyboard (unless you got another keyboard of course). Create the following launcher (in
home/user/.local/share/applications
) and add it to unity :Desktop entry (Unity launcher, Ubuntu 17.10 and below)
Result
Launcher:
[
Notifications:
[ [
Device
id
's received fromxinput list
as suggested in accepted answer are sometimes somehow changed on reboot (at least on my PC) which resulted in disabling wrong device.That's why I've ended using
device name
instead ofid
, e.g.:For Disabling Laptop's internal keyboard permanently On Ubuntu, Need pass this
i8042.nokbd
Kernel parameters for not to check/create keyboard porti8042.nokbd [HW] Don't check/create keyboard port
Open terminal and run the following command
Try to find the following line
Add parameter
i8042.nokbd
, the above line should be looks like thisUpdate grub as following command
Then
reboot
your laptop computer.I thought of 2 ways you can do this:
By setting up a wrong model for your laptop keyboard in xorg.conf ?
By installing Lock-keyboard-for-Baby
`Lock-keyboard-for-Baby or lk4b in short, is a small program which locks your keyboard but leaves your mouse free. I wrote it because my niece likes to bash away at my keyboard whenever she sees me sit down at it. Keys typed on a keyboard can have disastrous consequences and I didn't want to lock my screen all the time with a screensaver.
When started, lock-keyboard-for-baby opens a small window which grabs the keyboard and echos keys which are typed. By default, it tells you what to type to quit ("Quit Now").
Unlike a screensaver, your screen is not blocked and the mouse still partially works, so you can still see what is on your screen - keep watching tv / video and/or read a document using the mouse to scroll.`
Requirements:
· GTK >= 2.x · perl GTK2 bindings (perl-gtk2 or gtk2-perl depending on your system)
One sure way to disable it is to unplug the signal cable. You need to pop up the keyboard for that. For information on how to do that, check out the Maintenance and Service Guide for the HP Pavilion dv9000 and dv9200 Notebook PC .
Now there is a way to disable the keyboard using
xinput
. T do that, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.To list the devices your X
To disable the keyboard:
To enable the keyboard again:
If you get a error about permissions, use the commands above with
sudo
.Consequently, I discovered:
For example in my terminal:
Try running
xmodmap -e 'keycode 24='
to disable just the Q key. If that works, you could add it it to your~/.bashrc
or global/etc/bash.bashrc
file. I got this idea from here, which shows all the key-mappings.Input device indicator allows you to enable and/or disable your devices from a menu. It uses
xinput
internally, but you do not need to open the terminal, list manually, type the command etc.It is in a PPA, so you can install it with
To invoke it you just need to execute
input-device-indicator
(which can be added to the session startup programs) or look for "Input Device Indicator" through the HUD (or whatever it is called these days.)For what it's worth, based on previous answers and my own playing around, I created the following script, which I call
toggle_keyboard.sh
and place in my~/bin
path. I have a keyboard shortcut that runs it set to CtrlWinK.Some problems with the previous answers and benefit of my script:
xinput float 13
. I ended up disabling the wrong hardware.xinput list --name-only
. Just get the name and edit the top four variables. I use it for my laptop keyboard, webcam, touchscreen monitor and a few other things I use only once in a while.