I'm writing an open source application using KDE to sell in the Software Center. According to the requirements for uploading an application to the Software Center,

Write all configuration settings to ~/.config/ (This can be one file or a directory containing multiple configuration files)

By default, it appears that KDE applications store configuration files in ~/.kde/share/config/<name>rc. Is this not allowed? If so, how do I change where the file is stored? I'm using KConfig XT. The tutorial says

Start that file by opening the tag which controls which KConfig file the data will be stored in. There are three possibilities:

  1. If the <kcfgfile> tag has no attributes the generated code will use the application's default KConfig file (normally $HOME/.kde/config/<appname>rc).
  2. The "name" attribute is used to manually specify a file name. If the value assigned to "name" is not an absolute file path, the file will be created in the default KDE config directory (normally $HOME/.kde/config).
  3. If you would like to be able to specify the config file at construction time, use <kcfgfile arg="true">. This causes the constructor of the generated class to take a KSharedConfig::Ptr as an argument, allowing you to construct multiple instances pointing to different files.

I've tried setting the name attribute to be ~/.config/<appname>, but there is no file at that location, although settings are still being saved. Also, when I set the name attribute, other settings are still saved to ~/.kde/share/config/<appname>rc, such as window size.

How to I change where configuration data is stored for a KDE app so it will meet upload requirements for the Software Center?


If you are using the KConfig API, your application should be fine for uploading to MyApps and inclusion in the store.

You could also instead use the Qt bindings for dconf, dconf-qt, which would allow you to store your settings in dconf, which would be under the ~/.config/ directory.

Also note that the ~/.config/ requirement is perhaps not well specified in those requirements, as it should be $XDG_CONFIG_HOME instead, for which ~/.config/ is simply the default, and which users may decide to change to another location, so that the files underneath it, may be more easily accessible to them.

  • So if I'm using KConfig, everything is taken care of automatically and I don't have to do anything to make it store the files in the correct spot? – iBelieve Apr 15 '13 at 14:47
  • And just because I'm curious, will the configuration files still be stored under ~/.kde, or will they be stored under ~/.config, but only under Unity? – iBelieve Apr 15 '13 at 14:48
  • My understanding is that KConfig isn't using $XDG_CONFIG_HOME, and they will be stored under ~/.kde, regardless. I don't think this is, or should be, an issue for inclusion in the store, though. – dobey Apr 15 '13 at 14:54

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.