Thursday, December 11, 2014

Finally got my shiny, new openbsd boxes to let me type in Japanese. It was not hard, after all.

First, I got that tablet that I have complained so much about pointed to the packages directory in a local mirror (This was so I didn't have to log in as an admin user while I browsed the web, really. Didn't have non-admin users for surfing set up yet.):

You'll need to add an application that is capable of taking input through input methods, of course.

gedit and firefox are among the applications in the repository that will accept Japanese now.
]

(There's supposed to be a dictionary access tool, too, but I don't see it yet.)

If you want information on any of those packages before you add them, you can use the pkg_info command:

pkg_info ja-vim

Ignore the advice to mess with your font paths unless you have trouble displaying Japanese fonts when you connect to, say, NHK.

Now, you can start it by opening up your IBus Preferences in your Settings menu in, say, XFCE4. But that doesn't stick when you log out.

I'll update this post when I figure it out or get an answer on the mailing list. (I've seen some conflicting information around the internet, and haven't found something that works, yet.)

[Late update (2014.12.31):

As noted in this post to the openbsd list, getting XFCE4 to run the input method on startup was a lot "easier" than I expected. I found a post in the ubuntu forums which mentioned a Startup Items setting (in Gnome, maybe?). I looked around in the XCFE4 Settings menu and found the "Session and Startup" item.

Go to the "Application Autostart" tab in the Session and Startup dialog. Look for ibus and you won't find it. Click the add button. Add the following command:

/usr/local/bin/ibus-daemon -d

with appropriate name and comments. ("Start input method" and "So you can type in other languages", maybe?)

The "-d" argument appears to be the daemonize directive, in other words, it makes ibus a proper service, so to speak.

Adding these to .xinitrc does not seem to make any real difference for xfce4:

One more thing before you can type in Japanese, if you haven't done it yet: Log out and then back in. Notice the ibus icon now in your task bar or whatever you want to call it. It looks like a small keyboard with an even smaller globe of the world. In fact, right-click it. Select "Preferences" in the pop-up menu.

In the Preferences dialog, go to the "Input Method" tab. Select an input method (Japanese-Anthy in this case) from the "Input Method" pop-up menu, and click "Add". You have to click the Add button or it won't add the method. (I added "Japanese-Japanese", too, for some reason.)

When you close the dialog, the ibus icon changes to show a Latin "A" and a Kana "chi", which is supposed to indicate that Japanese is switched in.

In brief, for XFCE4:

Applications Menu=>

Session and Startup=>

Application Autostart=>

add command "/usr/local/bin/ibus-daemon -d"

and

Task Bar=>

Ibus Icon=>

Preferences=>

Input Method=>

Japanese-Anthy=>

Add

What that does for you in XFCE can be found with a few commands at the terminal:

I'll try to add instructions for more minimal stand-alone window managers at some point in the future, but the key should be adding the environment settings and command to start the ibus daemon in the appropriate X11 startup script, such as .xinitrc, etc. If I can spring the time, I'll try to look at other input methods, as well. No promises, however. See what you can do with the information above.