My Best Teaching Is One-on-One


Of course, I team teach and do special lessons, etc.


But my best work in the classroom is after the lesson is over --
going one-on-one,
helping individual students with their assignments.


It's kind of like with computer programs, walking the client through hands-on.
The job isn't really done until the customer is using the program.


Thursday, December 11, 2014

Typing in Japanese in OpenBSD

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.):
  • Choose a nearby mirror (In my case, jaist, in Japan).
  • Select a release (5.5 or 5.6 right now).
  • Select the packages directory (folder).
  • Select your architecture (in my current examply, i386, but maybe AMD64 for more modern 64 bit machines).
  • Wait several minutes for that page to load. It's a really long list.
  • Scroll down to the ja-*** stuff and read the package names.
  • Now, in a virtual console (ctrl-alt-F1 through -F4) where you have logged in as a wheel group (administrator) user, type: 
    • sudo pkg_add ja-fonts-gnu
    • sudo pkg_add ja-sazanami-ttf
    • sudo pkg_add ja-mplus-ttf
    • sudo pkg_add ibus-anthy
    as you read the package names out of that list. You'll need to type your administrator user password once or more times in the process.
And that should do the job.

[Really late update (2015.01.05):

Learn more about packages form this page:
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:
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
but they are recommended.

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"
  • 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:
  • ps wwaux | anthy # to show that the key is ibus
  • grep -R ibus  .
  • vi ".config/autostart/I bus daemon.desktop"
which reveals
[Desktop Entry]
Name=I bus daemon
Comment=Start ibus when xfce starts
Exec=/usr/local/bin/ibus-daemon -d
Playing with that should prove interesting and enlightening.

Gnome and other bloated desktop environments should be similar.

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.

end update]

No comments:

Post a Comment

Courtesy is courteous.