[kde-linux] globally using an input method engine

Joe Friedrichsen pengi.films at gmail.com
Fri Nov 4 09:12:16 UTC 2005


Kevin Krammer wrote:
> On Thursday 03 November 2005 14:30, Joe Friedrichsen wrote:
>
>> What is the best way to set these environment variables when KDE
>> launches an application? The Control Center (Regional and Accessibility)
>> area seems to be the best place, but I don't know if it gets this specific.
>
> One possible option is to affect the whole KDE environment by putting export 
> statements for those variables in a file read by the KDE startup script
> (for example files with .sh extension in ~/.kde/env)
>
> Another possibility would be to write a script that sets the variables and 
> then starts the application and have the menu entry point to this script.
>
> Cheers,
> Kevin

I like your first solution; I've got something similar to the second one 
working right now: I've written a script that sets the variables and 
then calls the whatever app is passed to it (see the very end); and 
since changing the whole menu item-by-item would be a pain, I've only 
changed my browser and mail client pointers (こんいちは).

How does ~/.kde/env differ from ~/.kde/Autostart? At the moment, 
~/.kde/env doesn't exist for me, but if KDE looks there, I'll happily 
create and populate it. Also, when is the exact moment those scripts are 
executed: when KDE first starts (so a once and over-and-done-with event) 
or each time KDE launches an app (by instance)?/ /I suppose the 
difference isn't really visible at run time so long as the variables are 
set before the application starts...


D. Levi Durham wrote:
> As someone who has been through setting up exactly this on more than one 
> distro (and getting it wrong many a time). I offer my solution. 
>
> I have a file in my home directory called .i18n (i think i stole the name from 
> mandrake but i use gentoo, and this works on both) containing:
>
> export LANGUAGE="en_US.utf8"
> export LANG="en_US.utf8"
> export LC_ALL="en_US.utf8"
> export XIM_PROGRAM="scim -d"
> export GTK_IM_MODULE="scim"
> export QT_IM_MODULE="scim"
> export XMODIFIERS="@im=SCIM"
>
> i then source that file from .bashrc with the line
>
> source ~/.i18n

I've tried that, but it only works for when applications are launched 
from a terminal (like Konsole), not the K menu. Please let me know if 
I'm misunderstanding something about your process.

Thanks!
Joe

#!/bin/bash
# Script to set up Japanese input

# Set the environment
export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
export LANG="en_US.UTF-8"
export LC_CTYPE="ja_JP.UTF-8"

# Start skim if it isn't already
if pgrep skim >> /dev/null; then :
else
   skim -d -f
fi

# Run the application
exec "$@" &

wait



More information about the kde-linux mailing list