Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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

1 Answer 1

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"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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