The ~ key of my laptop is broken, now I am seeking a method to map the # to it? How could I do it?

link|improve this question

73% accept rate
It's not clear what you want to change. The only sensible thing I can think of is to bind a different key to the ~ character. This depends on your terminal emulator (xterm, gnome-terminal, konsole, …): what terminal emulator do you use? Maybe you should change the system configuration instead; that depends somewhat on your desktop environment (Gnome, KDE, …). – Gilles Nov 14 '10 at 14:35
feedback

1 Answer

Keycode of 3/# key is 12:

]$ xmodmap -pk | grep "(3)"
    12         0x0033 (3)      0x0023 (numbersign)     0x0033 (3)      0x0023 (numbersign)

(xmodmap -pk displays current mapping)

You need to change mapping of this key when pressed with shift so it produces ~ instead of #. You do this like this:

echo "keycode 12 = 3 asciitilde" >> ~/.Xmodmap
xmodmap ~/.Xmodmap

In order to reset mapping back to original you remove above line from ~/.Xmodmap and do:

]$ xmodmap -e "keycode 12 = 3 numbersign"
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.