Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've recently acquired a new 84-key US layout keyboard, which has fewer keys than a standard UK layout keyboard. I'm using it in EN-US layout to avoid being unable to type # but I'd still like to be able to type £ without using alt codes and would like to map it to [RightAlt]+[3]. I've managed to map € to [RightAlt]+[4] using Ubuntu's built-in keyboard config tool but I'm a bit stuck on how to go about achieving what I want in Ubuntu 11.10.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I don't know the user-friendly way of doing this, so I hope you're fine with getting your hands dirty. :-)

  1. Open a terminal.
  2. Type xmodmap -pke and hit Enter.
  3. Scroll up until you find a line that looks as follows:

    keycode XX = 3 more stuff more stuff

  4. The important thing is that we have found what keycode relates to your key that emits 3 when pressed (without modifiers such as Shift, Alt, etc. that's what "more stuff" is on that line).

  5. Copy and paste that line to a file in your favorite text editor.
  6. Now, modify it so that the fifth entry after the equals sign is sterling. An example is from my laptop's Swedish keyboard layout (yours will likely differ, so don't be lazy and just copy-paste this, OK?):

    keycode 12 = 3 numbersign 3 numbersign sterling threesuperior

  7. Save the file as .Xmodmap in your home directory.

  8. Try it out! Run the following in the terminal: xmodmap ~/.Xmodmap
  9. The program doesn't give output, but changes your key mappings until you log in the next time. Hopefully, it worked.
  10. When you log in the next time, Gnome will hopefully (I run an older version of Ubuntu and Gnome, so I can't test for myself) find the file and ask if you want to run it henceforth. Say yes and forget you ever had to do all this. If it doesn't, add the command from Step 8 as an autostarting command in your Gnome session.
  11. Have a beer and congratulate yourself on a job well done. :-)

For more information about Xmodmap, I would recommend Arch Linux's wiki page about it.

share|improve this answer
add comment

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.