Fixing Japanese Keyboard Layout Dell Inspiron 1420 Ubuntu 8.04

After installing Ubuntu on my Dell laptop, one of the problems encountered was the keyboard. I have an uncommon Japanese keyboard layout since I bought the Inspiron in Japan. But hopefully the info is useful for modifying the keyboard in Ubuntu.

The first thing to do would be to go to System -> Preferences -> Keyboards, and choose the appropiate layout. Also click the Layout Options button and modify the Alt-Win behavior, choose to use the Win key as Super. I needed this to activate some cool Compiz animations comfortably 🙂

Then we’re going to need these three utilities: xev, xmodmap, xkeycaps. If you don’t have the xkeycaps, install it by:

sudo apt-get install xkeycaps

Xkeycaps is the GUI for xmodmap, use it first because it’s easy to modify. Just click and click. But you may encounter some keys that are not detected in xkeycaps, thus we must modify it manually through xmodmap. By the way, if you’re looking for the Fn key, it can’t be mapped because it modifies the key value through the BIOS/hardware.

Using xmodmap seemed hard, but turns out it’s not that scary. First, get the keycode of the button you wish to modify through xev. I think it’s self-explanatory. Then, modify the button with xmodmap, using the following syntax:

xmodmap -e “<expression>”

The <expression> field can be filled in with such expressions:

add <modbit> = keyvalue
remove <modbit> = keyvalue
keysym <value> = <another keysym value>
keycode <value> = <keysyms value>

Confused? Hopefully in most cases we won’t need to touch modbit. To map a key, we only need the simple last expression. Remember/note down the keycode-s to be changed. These keycodes are fixed to a certain button.

Now, change the “output” of that button by the keysyms value. Look it up on google, or in here.
In my case, my backslash-underscore button was like a dead button. I couldn’t type an backslash nor underscore, not very nice 🙂 This is what I typed in the terminal:

xmodmap -e “keycode 211=backslash underscore”

Easy as that, my “Super” (Win) key now works, and I can type underscores: ___ (Hooray)

PS: You may notice I use the nice Mac4Lin Theme. 🙂


Complete keysym list:

PS again: Please see the following link on how to make the changes run on every startup!!

It tells you how to put those commands in a file named .xmodmaprc in your home. It will be read everytime you login.


Posted on July 27, 2008, in Dell Inspiron 1420, Linux and tagged , , , , , . Bookmark the permalink. 6 Comments.

  1. hey cheers for posting that. it worked:)

    i work with old skool c programmers. they like to use _ a lot!


  2. you’re welcome ^^
    btw, u have an interesting blog.. read about the naked gaijin news.. XP

  3. thanx:) glad you enjoyed the video.

    found i needed to use this on another couple of machines, so wrote it into a little shell script

    at the command line:

    $ vi key

    then enter:


    xmodmap -e ‘keycode 211=backslash underscore’

    exit 0

    ESC :wq

    $ chmod +x

    $ ./key

    and hey presto!

  4. thanks for the script, I upgraded to Intrepid and had to re-program the keys.
    I’m going to write scripts from now on 😀

  5. Excellent post!

    Using xev, I was able to ascertain that my backslash/underscore key was 123, instead.

    So these two steps worked for me on Ubuntu 8.10 64amd:

    1. setxkbmap -model jp106 -layout jp -option
    2. xmodmap -e “keycode 123=backslash underscore”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: