recommended input methods?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

recommended input methods?

Joel Rees-2
What're the recommended input methods for Japanese and Spanish?

--
Joel Rees

Be careful when you see conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Bryan Linton
On 2014-10-14 14:02:52, Joel Rees <[hidden email]> wrote:
> What're the recommended input methods for Japanese and Spanish?
>

I can't speak for anything officially recommended, but for
Japanese at least, I use ports/inputmethods/anthy with
ports/inputmethods/uim and it works well.

The only complaint I have is that for some applications, namely
xombrero and xfe, they either do not accept Japanese input unless
their locale is specifically changed to Japanese, such as is the
case with xombrero, which has the side-effect of changing all
fonts to Japanese equivalents which makes for rather "ugly" font
choices made for the Latin alphabet, or in the case of xfe where
it just does not accept Japanese input at all no matter what I
have tried.

An xterm invoked as uxterm and started with a Japanese font allows
me to have a terminal which supports the input and display of
Japanese however, so I'm not quite sure what keeps xombrero and
xfe from working out-of-the box like Firefox, editors/leafpad, and
devel/geany, for example.  If anyone knows, please let me know.

I do have
        export XMODIFIERS=@im=uim
        export GTK_IM_MODULE="uim"
in my .xinitrc file.


As far as Spanish is concerned, I simply have a dead-key set up in
my .xinitrc
        setxkbmap -rules base -model pc105 -option "compose:menu"
which sets the "menu" key in-between the right-ALT and right-CTRL
keys to a dead-key such that pressing <MENU><"><a> will produce an
'a' with umlauts.  There are many other combinations as well.

You could probably use uim to to switch between a Spanish layout,
but it might be easier to do that with setxkbmap if you're
planning on typing in Spanish a lot, and are not just in need of
an occasional extended-Latin character.  If you'll only
occasionally need an extended-Latin character, then using a
dead-key would probably be the easiest route.

I'd be interested in what other people use for the above tasks as
well.

Hope this was helpful!

--
Bryan

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Abel Abraham Camarillo Ojeda-2
On Tue, Oct 14, 2014 at 1:14 AM, Bryan Linton <[hidden email]> wrote:

> On 2014-10-14 14:02:52, Joel Rees <[hidden email]> wrote:
>> What're the recommended input methods for Japanese and Spanish?
>>
>
> I can't speak for anything officially recommended, but for
> Japanese at least, I use ports/inputmethods/anthy with
> ports/inputmethods/uim and it works well.
>
> The only complaint I have is that for some applications, namely
> xombrero and xfe, they either do not accept Japanese input unless
> their locale is specifically changed to Japanese, such as is the
> case with xombrero, which has the side-effect of changing all
> fonts to Japanese equivalents which makes for rather "ugly" font
> choices made for the Latin alphabet, or in the case of xfe where
> it just does not accept Japanese input at all no matter what I
> have tried.
>
> An xterm invoked as uxterm and started with a Japanese font allows
> me to have a terminal which supports the input and display of
> Japanese however, so I'm not quite sure what keeps xombrero and
> xfe from working out-of-the box like Firefox, editors/leafpad, and
> devel/geany, for example.  If anyone knows, please let me know.
>
> I do have
>         export XMODIFIERS=@im=uim
>         export GTK_IM_MODULE="uim"
> in my .xinitrc file.
>
>
> As far as Spanish is concerned, I simply have a dead-key set up in
> my .xinitrc
>         setxkbmap -rules base -model pc105 -option "compose:menu"
> which sets the "menu" key in-between the right-ALT and right-CTRL
> keys to a dead-key such that pressing <MENU><"><a> will produce an
> 'a' with umlauts.  There are many other combinations as well.
>
> You could probably use uim to to switch between a Spanish layout,
> but it might be easier to do that with setxkbmap if you're
> planning on typing in Spanish a lot, and are not just in need of
> an occasional extended-Latin character.  If you'll only
> occasionally need an extended-Latin character, then using a
> dead-key would probably be the easiest route.
>
> I'd be interested in what other people use for the above tasks as
> well.
>
> Hope this was helpful!
>
> --
> Bryan
>

For spanish I also just map whatever key is more comfortable on
each particular keyboard to dead_acute (for accents) - which is the
most common used, and set a modifier key where I see fit and
declare extra keysyms for those keycodes:

$ cat .Xmodmap
[...]
keycode  10 = 1 exclam exclamdown

keycode  20 = slash question questiondown
keycode  25 = comma less guillemotleft

keycode  26 = period greater guillemotright
keycode  41 = u U udiaeresis Udiaeresis
keycode  46 = n N ntilde Ntilde
keycode  75 = dead_acute
keycode  94 = Mode_switch

[...]
$

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Anthony J. Bentley-3
In reply to this post by Bryan Linton
Hi Bryan,

Bryan Linton writes:
> I can't speak for anything officially recommended, but for
> Japanese at least...
(snip)
> As far as Spanish is concerned...
(snip)
> I'd be interested in what other people use for the above tasks as
> well.

For typing non-ASCII characters, I use a compose key (see Compose(5)).

$ setxkbmap -option compose:ralt

With XCompose you can remap your dead key sequences as much as you like
too, since they're just extra compose keys. Works great for European
languages with occasional accents as well as arbitrary UTF-8 symbols
which I end up using very often.

<Multi_key> <comma> <c> : "ç"
<Multi_key> <grave> <e> : "è"
<Multi_key> <apostrophe> <e> : "é"
<Multi_key> <asciicircum> <e> : "ê"
<Multi_key> <quotedbl> <e> : "ë"
<Multi_key> <asciitilde> <n> : "ñ"
<Multi_key> <asterisk> <G> : "Γ"
<Multi_key> <minus> <l> : "→"
<Multi_key> <plus> <minus> : "±"

And so on.

Sadly, this isn't really suitable for a language like Japanese that
really needs a true IME. yasuoka@ has suggested uim/anthy in the past
(http://yasuoka.net/~yasuoka/openbsd-desktop.html), and I haven't seen
anyone suggest an alternate method for Japanese input. It beats typing
romaji into Google Translate.

--
Anthony J. Bentley

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
In reply to this post by Bryan Linton
On Tue, Oct 14, 2014 at 3:14 PM, Bryan Linton <[hidden email]> wrote:

> On 2014-10-14 14:02:52, Joel Rees <[hidden email]> wrote:
>> What're the recommended input methods for Japanese and Spanish?
>>
>
> [...]
> The only complaint I have is that for some applications, namely
> xombrero and xfe, they either do not accept Japanese input unless
> their locale is specifically changed to Japanese, such as is the
> case with xombrero, which has the side-effect of changing all
> fonts to Japanese equivalents which makes for rather "ugly" font
> choices made for the Latin alphabet,
> [...]

Yeah.

The so-called two-byte characters are not appropriate for those.

If somebody doesn't beat be to it, I'll have to see if I can find
where to fix that. But it's not going to be this month or next I'm
afraid.

I'm still trying to figure out whether I've got enough of the locale
system set up to do something sensible when I say "export
LANG=ja_JP.UTF-8".

--
Joel Rees

Be careful when you see conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
In reply to this post by Joel Rees-2
Followup:

On Tue, Oct 14, 2014 at 2:02 PM, Joel Rees <[hidden email]> wrote:
> What're the recommended input methods for Japanese and Spanish?

I have got Japanese input running and useable, by installing the packages

ja-fonts-gnu
ja-sazanami-ttf
ja-mplus-ttf
ibus-anthy

with pkg_add . I'm not comfortable that this is the most optimal way
to do it, but it allows me to work on an openbsd box.

--
Joel Rees

Be careful when you look at conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself, as well.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
On Thu, Dec 11, 2014 at 10:07 PM, Joel Rees <[hidden email]> wrote:

> Followup:
>
> On Tue, Oct 14, 2014 at 2:02 PM, Joel Rees <[hidden email]> wrote:
>> What're the recommended input methods for Japanese and Spanish?
>
> I have got Japanese input running and useable, by installing the packages
>
> ja-fonts-gnu
> ja-sazanami-ttf
> ja-mplus-ttf
> ibus-anthy
>
> with pkg_add . I'm not comfortable that this is the most optimal way
> to do it, but it allows me to work on an openbsd box.

I should note, that I have to launch the ibus preferences (as from
Setings in XFCE4) to get the ime daemon started at this point. Haven't
found out how to get it to start when X11 starts.

--
Joel Rees

Be careful when you look at conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself, as well.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Kaspars Bankovskis
In reply to this post by Joel Rees-2
On Thu, Dec 11, 2014 at 10:07:35PM +0900, Joel Rees wrote:
> I have got Japanese input running and useable, by installing the packages
>
> ja-fonts-gnu
> ja-sazanami-ttf
> ja-mplus-ttf
> ibus-anthy
>
> with pkg_add . I'm not comfortable that this is the most optimal way
> to do it, but it allows me to work on an openbsd box.

Also, if you're comfortable with editors/emacs, it has Japanese input
method as well. Check set-input-method command.
Here's the setup I used for that:

emacs-24.3p5-no_x11
ja-sazanami-ttf-20040629p2
rxvt-unicode-9.20p1

~/.Xdefaults:
urxvt*font: xft:DejaVu Sans Mono:pixelsize=20,\
                xft:Sazanami Mincho
~/.xsession:
export LC_CTYPE=en_US.UTF-8

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Bryan Linton
In reply to this post by Joel Rees-2
On 2014-12-11 22:46:48, Joel Rees <[hidden email]> wrote:

> On Thu, Dec 11, 2014 at 10:07 PM, Joel Rees <[hidden email]> wrote:
> > Followup:
> >
> > On Tue, Oct 14, 2014 at 2:02 PM, Joel Rees <[hidden email]> wrote:
> >> What're the recommended input methods for Japanese and Spanish?
> >
> > I have got Japanese input running and useable, by installing the packages
> >
> > ja-fonts-gnu
> > ja-sazanami-ttf
> > ja-mplus-ttf
> > ibus-anthy
> >
> > with pkg_add . I'm not comfortable that this is the most optimal way
> > to do it, but it allows me to work on an openbsd box.
>
> I should note, that I have to launch the ibus preferences (as from
> Setings in XFCE4) to get the ime daemon started at this point. Haven't
> found out how to get it to start when X11 starts.
>

I use UIM, not ibus, but I have the following lines in my .xinitrc
(among several others which are not relevant here) which starts
UIM automatically when X is started.

        export XMODIFIERS=@im=uim
        export GTK_IM_MODULE="uim"
        export QT_IM_MODULE="uim"

        env LC_CTYPE=ja_JP.UTF-8 uim-xim &

        exec env LC_CTYPE="en_US.UTF-8" /usr/X11R6/bin/cwm

If you play around with these, you could probably get something
working with ibus.

For GTK at least, I think these module names are currently sourced
from either:
        /usr/local/lib/gtk-2.0/2.10.0/immodules
or
        /usr/local/lib/gtk-3.0/3.0.0/immodules

And are cached in /etc/gtk-2.0/gtk.immodules by running
gtk-query-immodules-2.0.  It seems like GTK-3 is doing something
different, maybe under ~/.config or something or just running
gtk-query-immodules-3.0 directly.  It works for me, so I haven't
really looked into it much.

Note that some applications refuse to accept Japanese input unless
they're run with the correct locale settings *AND* an overridden
input module, so I have

        bind C-g "env GTK_IM_MODULE=xim LC_CTYPE=ja_JP.UTF-8 gwaei"

in my .cwmrc so that a Japanese dictionary program of all things
will accept Japanese input.

As I said before, unfortunately xombrero needs the same hack
        #bind C-x "env GTK_IM_MODULE=xim LC_CTYPE=ja_JP.UTF-8 xombrero"
but this makes the fonts very ugly on most pages and in the
general UI.  I'm still hoping to find some way to get it to
support Japanese input without needing to force the locale to
change, since it seems like Firefox, xterms, and most any non-GTK
programs just "Do the Right Thing (TM)".

I find it somewhat ironic that I was able to get Japanese
input/output in xterm/irssi/mutt/tmux working with less than 5
minutes of reading manpages, but have spent literally hours
getting GTK to work.

GTK apps used to "Just Work (TM)", but it seems like after new
versions have been released over the last few years, more and more
hacks have been needed to keep things working.  First it was only
the LC_CTYPE=ja_JP.UTF-8 that was needed, now GTK_IM_MODULE=xim is
needed too.

I'm sure the GTK developers have good reasons for continually
changing these, but it's certainly inconvenient to upgrade GTK and
find that one's IME stops working.

Once again, any cluebats are appreciated, but I have a feeling
this is just how things are WRT needing all these environment
overrides.

I hope you're able to get ibus to start automatically from this
information.  If not, maybe try giving UIM a try?

--
Bryan

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
On Fri, Dec 12, 2014 at 12:12 PM, Bryan Linton <[hidden email]> wrote:

> On 2014-12-11 22:46:48, Joel Rees <[hidden email]> wrote:
>> On Thu, Dec 11, 2014 at 10:07 PM, Joel Rees <[hidden email]> wrote:
>> > Followup:
>> >
>> > On Tue, Oct 14, 2014 at 2:02 PM, Joel Rees <[hidden email]> wrote:
>> >> What're the recommended input methods for Japanese and Spanish?
>> >
>> > I have got Japanese input running and useable, by installing the packages
>> >
>> > ja-fonts-gnu
>> > ja-sazanami-ttf
>> > ja-mplus-ttf
>> > ibus-anthy
>> >
>> > with pkg_add . I'm not comfortable that this is the most optimal way
>> > to do it, but it allows me to work on an openbsd box.
>>
>> I should note, that I have to launch the ibus preferences (as from
>> Setings in XFCE4) to get the ime daemon started at this point. Haven't
>> found out how to get it to start when X11 starts.
>>
>
> I use UIM, not ibus, but I have the following lines in my .xinitrc
> (among several others which are not relevant here) which starts
> UIM automatically when X is started.
>
>         export XMODIFIERS=@im=uim
>         export GTK_IM_MODULE="uim"
>         export QT_IM_MODULE="uim"

For ibus:

    export GTK_IM_MODULE=ibus
    export XMODIFIERS=@im=ibus
    export QT_IM_MODULE=ibus

>         env LC_CTYPE=ja_JP.UTF-8 uim-xim &

I found this in the ubuntu lists:

    http://ubuntuforums.org/showthread.php?t=1315439

It talks about a Startup Items menu entry. There's an equivalent in
the XFCE4 Settings menu,

    Session and Startup

where you can go to the Application Autostart tab and Add (button) the
ibus daemon as an application with the command

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

where -d is daemonize. (And I'd like to find in XFCE4 where that gets
registered.) It doesn't seem to need the LC_CTYPE env variable to be
specified as Japanese for ibus.

The archlinux pages on ibus:

    https://wiki.archlinux.org/index.php/IBus

suggest an ibus-qt package which we don't seem to have in openbsd, at
least not as a separate package.

>         exec env LC_CTYPE="en_US.UTF-8" /usr/X11R6/bin/cwm

For XFCE4, we have the

   startxfce4

command, and, again, it doesn't seem to need LC_CTYPE to be specified.

I'll try to make some time to play around with cwm later. XFCE4 is
sometimes too cumbersome, too.

> If you play around with these, you could probably get something
> working with ibus.

I want to figure out what the following is about later:

> For GTK at least, I think these module names are currently sourced
> from either:
>         /usr/local/lib/gtk-2.0/2.10.0/immodules
> or
>         /usr/local/lib/gtk-3.0/3.0.0/immodules
>
> And are cached in /etc/gtk-2.0/gtk.immodules by running
> gtk-query-immodules-2.0.  It seems like GTK-3 is doing something
> different, maybe under ~/.config or something or just running
> gtk-query-immodules-3.0 directly.  It works for me, so I haven't
> really looked into it much.
>
> Note that some applications refuse to accept Japanese input unless
> they're run with the correct locale settings *AND* an overridden
> input module, so I have
>
>         bind C-g "env GTK_IM_MODULE=xim LC_CTYPE=ja_JP.UTF-8 gwaei"
>
> in my .cwmrc so that a Japanese dictionary program of all things
> will accept Japanese input.
>
> As I said before, unfortunately xombrero needs the same hack
>         #bind C-x "env GTK_IM_MODULE=xim LC_CTYPE=ja_JP.UTF-8 xombrero"
> but this makes the fonts very ugly on most pages and in the
> general UI.  I'm still hoping to find some way to get it to
> support Japanese input without needing to force the locale to
> change, since it seems like Firefox, xterms, and most any non-GTK
> programs just "Do the Right Thing (TM)".

I've found, with the Japanese fonts installed, I don't need to specify
the LC_CTYPE as Japanese, if I don't need Japanese language menus. (My
kids need to practice their English anyway?) And that avoids the
ugliness of two-byte double-width Latin characters.

> I find it somewhat ironic that I was able to get Japanese
> input/output in xterm/irssi/mutt/tmux working with less than 5
> minutes of reading manpages, but have spent literally hours
> getting GTK to work.
>
> GTK apps used to "Just Work (TM)", but it seems like after new
> versions have been released over the last few years, more and more
> hacks have been needed to keep things working.  First it was only
> the LC_CTYPE=ja_JP.UTF-8 that was needed, now GTK_IM_MODULE=xim is
> needed too.
>
> I'm sure the GTK developers have good reasons for continually
> changing these, but it's certainly inconvenient to upgrade GTK and
> find that one's IME stops working.
>
> Once again, any cluebats are appreciated, but I have a feeling
> this is just how things are WRT needing all these environment
> overrides.
>
> I hope you're able to get ibus to start automatically from this
> information.  If not, maybe try giving UIM a try?

More things I need to experiment with when I get a chance.

--
Joel Rees

Be careful when you look at conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself, as well.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
I've posted on getting anthy going in XFCE4 on my general blog:

http://reiisi.blogspot.jp/2014/12/typing-in-japanese-in-openbsd.html

I'll try to trim that up a bit for a FAQ entry in a few days, if it
looks appropriate.

Reply | Threaded
Open this post in threaded view
|

Re: recommended input methods?

Joel Rees-2
On Wed, Dec 31, 2014 at 9:28 PM, Joel Rees <[hidden email]> wrote:
> I've posted on getting anthy going in XFCE4 on my general blog:
>
> http://reiisi.blogspot.jp/2014/12/typing-in-japanese-in-openbsd.html
>
> I'll try to trim that up a bit for a FAQ entry in a few days, if it
> looks appropriate.

I'm getting closer to feeling like I can write an intelligent FAQ on
the anthy IME. Figured out how to get anthy running on some apps
within fvwm. Apps that don't understand Unicode or input methods won't
see the IME, of course.

I finally understand what the man page says about the X11 session
ending when .xinitrc exits.

So I copied /etc/X11/xinit/xinitrc to my home directory and renamed it
.xinitrc. Modified it according to the comments in the following:

----------------------------
#!/bin/sh
# $OpenBSD: xinitrc.cpp,v 1.12 2014/02/26 14:21:28 matthieu Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap


# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# modifying it here JMR20150106

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

#export GTK_IM_MODULE="uim"
#export QT_IM_MODULE="uim"
#export XMODIFIERS=@im=uim
#export LC_CTYPE=ja_JP.utf8
#scim -d

# end modifications JMR20150106

# if we have private ssh key(s), start ssh-agent and add the key(s)
id1=$HOME/.ssh/identity
id2=$HOME/.ssh/id_dsa
id3=$HOME/.ssh/id_rsa
id4=$HOME/.ssh/id_ecdsa
id5=$HOME/.ssh/id_ed25519

if [ -z "$SSH_AGENT_PID" ];
then
if [ -x /usr/bin/ssh-agent ] && [ -f $id1 -o -f $id2 -o -f $id3 -o -f
$id4 -o -f $id5 ];
then
eval `ssh-agent -s`
ssh-add < /dev/null
fi
fi

# if dbus is installed, start its daemon
if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
eval `dbus-launch --sh-syntax --exit-with-session`
fi

# start some nice programs

# modifying it here, too JMR20150106
# start the various ibus processes

/usr/local/bin/ibus-daemon &
/usr/local/bin/python2.7 /usr/local/share/ibus-anthy/engine/main.py --ibus &
# /usr/local/libexec/ibus-engine-simple "(ibus-engine-simple)" &
# Do this from the command line after X11 comes up and gives you a shell:
# /usr/local/bin/ibus engine anthy
# Or, maybe:
# export ENGINE_NAME=anthy
# end modifications JMR20150106


xclock -geometry 50x50-1+1 &
xconsole -iconic &
xterm -geometry 80x24 &
fvwm || xterm

if [ "$SSH_AGENT_PID" ]; then
ssh-add -D < /dev/null
eval `ssh-agent -s -k`
fi
----------------------------

As I noted in the comments, you have to specify anthy as the engine
after I  get fvwm up and have a shell in it to do it in:

$    ibus engine anthy

After that, any window in the fvwm session will be able to accept text
from gedit or firefox or other application that accepts input from an
IME.

XFCE4 seems to ignore .xinitrc .

--
Joel Rees

Be careful when you look at conspiracy.
Look first in your own heart,
and ask yourself if you are not your own worst enemy.
Arm yourself with knowledge of yourself, as well.