PDA

View Full Version : X.org Japanese keyboard configuration


deuce63
May 3rd, 2009, 11:46
As a FreeBSD noob, I have a few dumb questions to ask... and unfortunately my search in man documents and web pages yielded nothing I could understand.

First of all, I managed the install of FreeBSD and Xorg 7.4 no problem. In the terminal outside of x, my keyboard works perfectly, but once in X, I need a .xmodmaprc to get some keys to work.

The problem is that I don't know how to get it to load automatically when I type "startx".

I made an .xinitrc with a single line:

xmodmap ~/.xmodmaprc

I'm assuming this will load .xmodmaprc correctly, but then X exits. (Forgive me if this is a "duh" type thing, but I'm really new to FreeBSD)

Another question to ask... is it possible to set up this .xmodmap configuration globally (i.e. system wide, without having to create a new .xinitrc for every new user)?

ale
May 3rd, 2009, 12:04
Try reading this post

deuce63
May 5th, 2009, 07:52
Thank you for pointing me there. I managed a working solution that combined your hal configuration with xinitrc scripts. I probably should have mentioned that I had a Logitech Standard Japanese 109 key USB keyboard. I'll post my solution for a critique, and so others can follow it.

First off, the contensts of my hal configuration, in /usr/local/etc/hal/fdi/policy/10-x11-input.fdi:


<?xml version "1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="info.capabilities" contains="input.keyboard">
<merge key="input.x11_options.XkbModel" type="string">jp106</merge>
<merge key="input.x11_options.XkbLayout" type="string">jp</merge>
</match>
</device>
</deviceinfo>


This results in a nearly fully functioning keyboard with the exception of 3 keys: namely, the backlash/underscore, Henkan, the Romaji/KatakanaHiragana toggle keys.

To get these keys working globally by default, I needed to create the file .Xmodmap in the /usr/local/lib/X11/xinit/ directory, with the following code.


keycode 151 = backslash underscore
keycode 143 = Henkan
keycode 148 = Hiragana_Katakana


The only problem with this is if you create a user, and they create a new .xinitrc in their home directory(like to use their favorite WM), ZAP! There goes the modmapping.

So I created a file dot.xinitrc in the /usr/share/skel directory, with this code:


# Warning! Erasing this line will result in non-functioning keys!
xmodmap /usr/local/lib/X11/xinit/.Xmodmap

# Modify this line to use a different window manager
exec twm


With this, when a new user is created with adduser, the .xinitrc gets copied to their home directory by default.

Why is all this necessary?

From what I can gather digging around in the files in /usr/local/share/X11/xkb directory, there seems to be no support for 109 key variants of japanese keyboards in xorg (perhaps by default). Under Ubuntu, these files are heavily modified. I think mailing lists suggest other distros may do similarly as well: meaning, most of the time, a working hal configuration would do the trick.

I may attempt to edit them for interests sake. If I come up with a working patch, where would I send it? To xorg, or Freebsd?