Numpad key repeating continuously [duplicate]

Solution 1:

Try this in a bash script file:

#!/bin/bash

xinput test 11 |

while read pkc
do
   if [[ "$pkc" =~ "key press   38" ]]
   then
        xmodmap -e 'keycode 38 = ';
        sleep 0.5;
        xmodmap -e 'keycode 38 = a A';
   fi
done
  • Change the number 11 in xinput test 11 to your keyboard device number. You can find this number by running xinput list. You might need to check if the id number is the right one for your keyboard. To do that choose the keyboard id numbers with slave keyboard in-front of them then check the id in the terminal by running xinput test id_number and press the a on your keyboard. If you get an output like key press 38 then this is the correct id number for your current keyboard and if no output, continue testing the other id numbers until you see output.

  • Change the nuber 38 in "key press 38" and xmodmap -e 'keycode 38 = '; and xmodmap -e 'keycode 38 = a A'; to the key code of the a key. You can find this number by running xev and pressing the a key.

  • Change the number 0.5 in sleep 0.5; to the desired period in seconds for the a key to be disabled.


Steps to creating and using the script file:

  1. Create and open the file in an editor by running the following command in the terminal:
nano ~/no_aa.sh
  1. Copy and paste the above code ( after modifying it ) into the editor.

  2. Save the script file and exit the editor by pressing Ctrl + X then press Y.

  3. Make the script file executable by running the following command in the terminal:

chmod +x ~/no_aa.sh
  1. Run the script by running the following command in the terminal:
bash ~/no_aa.sh
  1. Keep the terminal open and test the a key in other applications like writing in the LibreOffice writer.