Author Topic: HHKB Japanese how to map the Muhenkan key using xmodmap in Ubuntu  (Read 4804 times)

0 Members and 1 Guest are viewing this topic.

Offline clearsorreds

  • Thread Starter
  • Posts: 2
Hello Everyone,

This is my first ever post. I received the HHKB Japanese layout today. I didn't find any tutorial on how to do this, so I thought I'd share how to remap the Muhenkan key to the left of the space bar using xmodmap in Ubuntu. I failed to remap the key in both xmodmap and xkb until i wrote this in my hhkb.xmodmap file.

xev showed the keycode/key to be:

Code: [Select]
state 0x0, keycode 102 (keysym0xff22, Muhenkan)
But I kept getting an error in xmodmap and in xkb trying to remap it to backspace using:

Code: [Select]
keycode 102 = BackSpace
and

Code: [Select]
keysym 0xff22 = 0xff08
until I wrote this:

Code: [Select]
keycode any = 0xff08
I don't know why the key is not mapped in Ubuntu. It may be a bug. This is the first time I have ever needed to use
Code: [Select]
keycode any.

You can remap the Henkan key to anything you like. If you want to make the space bar a little longer to the left you could add this to your .Xmodmap or hhkb.xmodmap file
Code: [Select]
keycode any = 0x20
I have a tendency on western keyboards to tap the space bar on the right side. I simply remapped Henkan_Mode key to the right of space bar to space.
Code: [Select]
keycode 100 = space
and i remapped the key Hiragana_Katagana to the right of the Henkan_Mode key to another return key
Code: [Select]
keycode 101 = return
I have quickly taken a shine to the keyboard, and after remapping the layout, it's definitely fantastic to not have to reach for the backspace and return keys.

Edit: Thank you Hasu for pointing out that unfortunate typo!
« Last Edit: Sun, 19 July 2015, 18:00:37 by clearsorreds »

Offline hasu

  • Posts: 3491
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: HHKB Japanese how to map the Muhenkan key using xmodmap in Ubuntu
« Reply #1 on: Sun, 19 July 2015, 11:48:11 »
BackSpace? instead of 'Backspace'.

This works well to me.
Code: [Select]
xmodmap -e 'keycode 102 = BackSpace'

Offline clearsorreds

  • Thread Starter
  • Posts: 2
Re: HHKB Japanese how to map the Muhenkan key using xmodmap in Ubuntu
« Reply #2 on: Sun, 19 July 2015, 18:26:55 »
Unfortunately, once I power up Ubuntu 14.04 or 15.04, my computer won't recognize keycode 102. If I want to change "keycode any" after its first remapping via xmodmap, i noticed later last night to remap the Muhenkan key again without resetting the keyboard via the command: "setxkbmap -layout us" (which works for us keyboards), it no longer recognizes "keycode any" but rather the expected keycode 102, until i restart the computer.

In my hhkb script to work around any issue remapping the Muhenkan Key after invoking the script the first time without restarting and avoiding typing the setxkbmap command. I include in the hhkb.xmodmap file "keycode any", but I added this to my hhkb script, and it works perfectly:

Code: [Select]
~/hhkb.xmodmap && xmodmap -e "keycode 102 = BackSpace"