Karen Gabrielyan Karen Gabrielyan - 1 year ago 102
Linux Question

How to make IBus input method for Chinese work for sudo-ed apps on Debian Linux?

I've installed IBus and IBus Pinyin on Debian Linux to be able typing Chinese into the apps.

But what I see is that if any app is run in Gnome or LXDE on Debian as root, the input method does not work.

I'm able to type Chinese only on regular apps launched as current user.
So there seems to be an issue with privileges, or the user accounts under which the applications are launched.

To be more specific, I used Qupzilla browser to test this (apt-get install qupzilla).
Also I installed the following IBus packages: apt-get install ibus, ibus-pinyin, ibus-gtk, ibus-qt4

When I launch Qupzilla as regular user from Gnome or LXDE terminal (through > qupzilla &), everything works fine. I'm able to switch to Chinese input through Super+Space press, and I see Chinese characters showing up in little window, as I choose them, they properly show up in Qupzilla screen content.

But when I launch the same app as root ( through > sudo qupzilla &), Chinese input does not work. I see in the tray icon that pressing Super+Space switches the input language to English or Chinese, but the Chinese characters do not show up at all.

It's important for my application to be launched through sudo, as it requires special privileges on the system.

Can anyone help with an advice on how to make it possible inputting Chinese into app running as root under Gnome/LXDE?

I'd appreciate any help and feedback on this.

Answer Source

Got an answer to this question in Debian forum, see here for more details: http://forums.debian.net/viewtopic.php?f=6&t=130383

If the app is launched with sudo -E, the environment variables from session are passed on to the app and it thenmanages to use IBus properly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download