knxm / mathlibre

Live Linux for Mathematical Software
Other
18 stars 6 forks source link

Which is better input method, ibus or uim, or other? #10

Closed knxm closed 11 years ago

knxm commented 11 years ago

uim has some bugs with lxpanel. It does not change color sometimes. How do I set the ibus with Shift-space and ibus-mozc.

Where is the setting file for ibus. Is it in repositories?

seijimtmt commented 11 years ago

In my case, the setting is in ~/.gconf/desktop/ibus/general/hotkey/%gconf.xml

$ cat ~/.gconf/desktop/ibus/general/hotkey/%gconf.xml
<?xml version="1.0"?>
<gconf>
        <entry name="trigger" mtime="1361535767" type="list" ltype="string">
                <li type="string">
                        <stringvalue>Shift+space</stringvalue>
                </li>
                <li type="string">
                        <stringvalue>Zenkaku_Hankaku</stringvalue>
                </li>
                <li type="string">
                        <stringvalue>Alt+Kanji</stringvalue>
                </li>
                <li type="string">
                        <stringvalue>Alt+grave</stringvalue>
                </li>
                <li type="string">
                        <stringvalue>Hangul</stringvalue>
                </li>
                <li type="string">
                        <stringvalue>Alt+Release+Alt_R</stringvalue>
                </li>
        </entry>
</gconf>

I've found a related topic at Ubuntu Japanese Forum: https://forums.ubuntulinux.jp/viewtopic.php?id=12351 . Although I've not tried yet, It is recommended to use "gconftool" for setting, instead of editing the file directly. (as a hook?)

knxm commented 11 years ago

Thank you very much for your kind advice. I want to write script similar to emacs.chroot. But it does not work.

I determined to set the configulation files .gconf and .config to config/includes.chroot/etc/skel .

I will consider how to change input method for Korean and Chinese language. I think .gconf/desktop/ibus/panel/%gconf.xml is for the selection of input method.

seijimtmt commented 11 years ago

I checked only for the Japanese input method, but hope the same steps will work for the Korean/Chinese.

# gconftool --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
    --type list --list-type=string --set /desktop/ibus/general/preload_engines [mozc-jp,anthy]

Of course, a single entry [mozc-jp] will be fine. It will modify "/etc/gconf/gconf.xml.defaults/%gconf-tree.xml" (in merged tree format).

Similarly you can assign the "enable/disable" key(s) with the command:

# gconftool --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
    --type list --list-type=string \
    --set /desktop/ibus/general/hotkey/trigger [Shift+space,Zenkaku_Hankaku,Alt+Kanji]

Please try to add these commands to the hook when you have time.

seijimtmt commented 11 years ago

Here is a simple way I've used to check my customizations:

1) dump the current settings before customizations.

$ gconftool --dump /desktop/ibus > dump.old

2) customize ibus with "ibus-setup" (a GUI tool). 3) dump the new settings.

$ gconftool --dump /desktop/ibus > dump.new

4) compare the old/new settings

$ diff -c dump.old dump.new

Then it's easy to apply these local settings (changes) to the system (global) ones with gconftool as explained in my previous comment. I think these steps can also be used to customize other gnome apps ( "gconftool --dump /")

knxm commented 11 years ago

Thank you for your nice comments, and especially, the last comment is the one I'm very much interested in.

But, I couldn't set ibus with this way and I can't find the /etc/gconf/gconf.xml.defaults/%gconf-tree.xml.

$ ls -l /etc/gconf/gconf.xml.defaults/%gconf-tree.xml 
-rw-r--r-- 1 root root 0  2月 25 11:02 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml

This is my ibus.chroot script

#!/bin/sh

mkdir -p /etc/gconf/gconf.xml.defaults/
touch /etc/gconf/gconf.xml.defaults/%gconf-tree.xml
case $LANG in
    ja_JP.UTF-8)
        /usr/bin/gconftool --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type list --list-type=string --set /desktop/ibus/general/preload_engines [mozc-jp,anthy]
        /usr/bin/gconftool --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type list --list-type=string --set /desktop/ibus/general/hotkey/trigger [Shift+space,Zenkaku_Hankaku,Alt+Kanji]
        ;;
    ko_KR.UTF-8)
        /usr/bin/gconftool --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type list --list-type=string --set /desktop/ibus/general/preload_engines [hangul]
        ;;
    zh_CN.UTF-8)
        /usr/bin/gconftool --direct --config-source xml:readwrite:/etc/g
conf/gconf.xml.defaults --type list --list-type=string --set /desktop/ibus/general/preload_engines [pinyin,sunpinyin,googlepinyin]
        ;;
esac

I think it is no problem in my host machine, but it's not effective for constructing live system.

knxm commented 11 years ago

Finally, we determined to configure in lang/ja script, because when we build chroot, always LANG=C, we can not use case statement.