Outils pour utilisateurs

Outils du site


issue48:c_c

Ceci est une ancienne révision du document !


This month, I felt I would share with you something I just recently learned about. The topics I'll be covering apply only to those readers who either use iBus/SCIM and aren't happy with it, or who have it running and are happy with it - but whose Japanese/Chinese/etc. doesn't appear in a legible font in rxvt-unicode. Also, I'd like to take a moment to announce that next month I hope to do a question and answer session for C&C readers. If you have questions about Linux in general, the command-line, or me as an author, feel free to send your questions to lswest34@gmail.com before the 28th of April. I will be selecting a bunch of questions to answer next month. Requests for articles are also welcome.

As some of you probably know, I wrote an article on iBus in issue #43 of FCM. I hadn't used iBus since I was comfortable with SCIM. However, an update recently disabled SCIM, and so I tried iBus. What really got me was that I couldn't switch between hiragana and katakana easily, so I decided to take a suggestion from a friend of mine and tried out uim. Surprisingly, uim doesn't block my dead keys in rxvt-unicode, and allows easy switching between hiragana and katakana. Below is how I configured it for use.

uim & uim-fep:

From the homepage (http://code.google.com/p/uim/): “uim's goal is to provide simple, easily extensible and high code-quality input method development platform, and useful input method environment for users of desktop and embedded platforms. See what's uim? for further information.”

First, you'll need to install it:

sudo apt-get install uim uim-gtk2.0 uim-qt uim-qt3 uim-fep uim-anthy

This should cover uim support for terminals, QT applications, and GTK applications using anthy. There are a number of other packages offering applets, different dictionaries, and utilities, that may be of interest to some people.

Once you've installed it, running uim-toolbar-gtk-systray will give you a system tray icon. Right-click on it and choose preferences. Here, I would adjust the list of enabled input languages to only the ones you need, and adjust the global key bindings to your preferences. If you find that the system tray icon is practically invisible, it's because too much information is being displayed in the one “icon” width. To adjust this, open the preferences, and, under “Toolbar”, uncheck everything, and set the enabled toolbar buttons per language that you use to just “Input Mode”. This will reduce it to one icon - making it readable again. Also, in order to get it working, you'll need to add the following to /etc/profile (or .bashrc, or .zshrc):

export XMODIFIERS=@im=uim

export GTK_IM_MODULE=“uim”

export QT_IM_MODULE=“uim”

Once you've set these variables, you should run the following in a terminal:

gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

This will re-create the gtk.immodules file, which specifies to GTK programs which Input Method types are available.

Uim-fep is a Front-End Processor for terminal emulators. Basically, it allows you to type Japanese in a terminal emulator (rxvt-unicode in my case), without relying on uim-xim (which is a bit of a resource hog). In order to get it working, you'll need to add uim-fep to the end of your .bashrc, or your .zshrc, or whatever shell you’re using. If you get a warning that uim-fep is already running, you can add “clear” (without the quotes) after it, so that it hides the message. Once it's running, you'll have a line at the end of your terminal that looks something like this:

Using the global shortcut for uim will result in the icon at the end changing to the input method, and allows you to type Japanese in-line in the terminal.

Rxvt-unicode:

In case you have the problem that your Japanese is nearly unreadable in rxvt-unicode (this may apply to other terminal emulators as well, but I haven't tested it), then you can add the following to your .Xdefaults:

URxvt.preeditType: OnTheSpot,None

URxvt.imLocale: ja_JP.UTF-8

URxvt.font: xft:Anonymous Pro:size=11:antialias=true:autohint=false,xft:IPAGothic:size=11:antialias=true

URxvt.boldFont: xft:Anonymous Pro:size=11:weight=Bold:antialias=true:autohint=false,xft:IPAGothic:size=11:weight=Bold:antialias=true

This, basically, tells urxvt to expect Japanese input from uim. The fonts are actually a list of two, as you can see. Anonymous Pro is the terminal font I use for everything, but if rxvt-unicode can't find the symbols for something in that font, it will move on to the next one in the list (or a fallback font if there is no such symbol in any font listed). This allows you to have support for multiple languages without compromising the readability of Latin symbols. Also, you may see some people using urxvt.* instead of URxvt.* - which can be problematic if you set the name of your terminal from a shortcut (i.e. urxvt -name ncmpcpp -e ncmpcpp). The first section of these preferences tells the system that the WM_CLASS of the program is that we want to affect, and the lowercase “urxvt” is the first of the list, which is set using the -name argument. If, instead, you use “URxvt”, then it will not change depending on the -name switch. To see what I mean, enter the following command into a terminal, and click on rxvt-unicode.

xprop|grep “^WM_CLASS”

Which gives you something like this:

WM_CLASS(STRING) = “urxvt”, “URxvt”

Now you should have a fully functional uim setup, and shouldn't have had to compromise any functionality in your terminal either. If you have any suggestions, or requests for articles, feel free to email me at lswest34@gmail.com. Also, don't forget your questions! I will need the questions sent in before the 28th of April!

issue48/c_c.1304879885.txt.gz · Dernière modification : 2011/05/08 20:38 de fredphil91