So, my laptop delete key is stuck internally. I tried disabling it using xmod -e 'keycode 119 = 0x0000'
. But I am still detecting it in xev. Sometime when text editor is open everything gets deleted. I have added the above command in start-up application to no avail.
Find the keycode for your Delete key by running
xev | grep --line-buffered keycode
. For many keyboards, the Delete key is mapped to keycode 119. Thexev | grep --line-buffered keycode
command opens a small Event Tester window with a big black square in it. Click inside the black square and press the Delete key. On my Ubuntu the result of pressing the Delete key wasstate 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
which showed thatkeycode 119
is mapped to theDelete
key on my keyboard.Use
xmodmap -e 'keycode 119 = NoSymbol'
to disable the Delete key. Press the Delete key to check if the command worked.To make this change permanent open the .Xmodmap file for editing in nano text editor.
Add the following line, and then save the changes to .Xmodmap using the keyboard shortcuts at the bottom of this answer.
Create an .xprofile file if it does not already exist.
Open the .xprofile file for editing in nano text editor.
Load the change made by disabling the Delete key automatically on login by adding this line to your .xprofile file:
The instructions for using nano are always displayed at the bottom of the page. Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location. Use the keyboard combination Ctrl + X to exit nano.