LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux Mint (https://www.linuxquestions.org/questions/linux-mint-84/)
-   -   Reassign broken Esc key in 19.1 (https://www.linuxquestions.org/questions/linux-mint-84/reassign-broken-esc-key-in-19-1-a-4175655071/)

ericlindellnyc 06-03-2019 02:06 PM

Reassign broken Esc key in 19.1
 
Suggestions I found online to reassign keys in Linux either don't apply
  • to Mint 19.1; or
  • to ESC key.

How to re-assign my broken Esc key to any other key combination?
Thanks.

I have Cinnamon desktop.

hydrurga 06-03-2019 02:59 PM

Just so I understand correctly, your Esc key is broken and you want to program another key or key combination to generate Esc?

ericlindellnyc 06-03-2019 06:12 PM

Yes.

hydrurga 06-04-2019 05:34 AM

Ok, in that case, for a while (until I bought myself a new keyboard and installed it in my laptop), I had a very intermittent "i" key so reprogrammed the F9 key to produce "i"'s in a Linux Mint 19 system. Here's how I did it:

I first ran the following command and pressed the relevant keys to find out the keycodes for the "i" key and the "F9" key:

Code:

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
This resulted in "i": 31 and "F9": 75. In your case, on my system, "Escape" is 9.

I then ran the following to determine the exact text in the lines relating to both these keys:

Code:

xmodmap -pke
After that, I ran the following command to create a file to override the specific xmodmap setting for F9, populating it with the "i" line obtained above but replacing its keycode with the keycode for F9. I then saved and closed the file.

Code:

sudo xed ~/.Xmodmap
I tested this with:

Code:

xmodmap ~/.Xmodmap
This setting gets lost on reboot/shutdown so in order to change it on every system startup, I added the following command to my startup applications:

Code:

bash -c "sleep 10 && /usr/bin/xmodmap /home/$USER/.Xmodmap"
Let me know how you get on.


All times are GMT -5. The time now is 02:58 PM.