Reconfigure KDE locale and keyboard from a script

Duncan 1i5t5.duncan at
Mon Jan 14 05:10:05 GMT 2013

Ivan Voras posted on Sun, 13 Jan 2013 22:16:59 +0100 as excerpted:

> I need to do unattended reconfigurations of systems with KDE installed,
> which includes changing the desktop locale. I searched around but cannot
> find any data on how to do it without using the GUI.
> Even more, X will not be running during the reconfiguration.
> I found kwriteconfig but not how to use it to do the task I need it to
> do. I would need to set / change the locale priorities. has a whole sysadmin handbook, quite a number of pages 
of information, on this sort of thing.  Let's see if I can dig up a more 
direct URL...

I've found the kde and xdg hierarchy (under filesystem) and  environment 
vars sections extremely helpful here.  (For kde4, most stuff is still 
using kde specific vars/fs-locations, but some of the newer apps use the 
xdg standard vars/locations, and I suspect kde frameworks, aka kde5, to 
make many of the old kde-specific locations "legacy", tho it may still 
support them.)

It's worth noting that for filesystem locations (and the associated config 
vars), both the kde and xdg specs have an order, from first to last, with 
later overriding earlier:

1) built-in-defaults (overridden by...)

2) system config (vars XDG_CONFIG_DIRS, /etc/xdg/, XDG_DATA_DIRS, /usr/
local/share/, /usr/share/, KDEDIRS, distro-specific but often /usr/bin/ 
and /usr/share/config/ ) and multiple locations possible, so you can set 
it up so the distro config is overridden by corporate config which is 
overridden by machine config, here the first one listed takes precedence, 
see the documentation ... overridden by...)

3) user config (XDG_CONFIG_HOME, $HOME/.config/, XDG_DATA_HOME, 
$HOME/.local/share/ , KDEHOME, ~/.kde/ (as shipped, tho some distros make 
that ~/.kde4 or similar) it's possible to lock down the user config, see 
the kiosk documentation, sometimes overridden by...)

4) command-line options

To address your specific question, while I'm en-US and don't have a whole 
lot of personal experience with locale setting, I believe a clean kde 
config will honor the LANG and/or LOCALE variables.  The kde-specific 
KDE_LANG variable should override the more generic variables if set, 
according to the vars docs as mentioned above.

I'd seriously suggest either (both?) remembering if you 
will, or bookmarking the kde sysadmin guide, to refer back to later.  
There's a lot of VERY helpful information for sysadmins and customizers 
(I'm both... and running gentoo, perfect for it, too! =:^) there, and 
time and again I find myself referring back to it, both for my own use, 
and in answers such as this one for others. =:^)

Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list