--- src/ime-core/imi_options.cpp.orig	2014-11-14 14:17:48 UTC
+++ src/ime-core/imi_options.cpp
@@ -73,12 +73,15 @@ CSimplifiedChinesePolicy::loadResources(
 
     if (!m_user_data_dir.size()) {
         char path[256];
-        const char *home = getenv("HOME");
-        snprintf(path,
-                 sizeof(path),
-                 "%s/%s",
-                 home,
-                 SUNPINYIN_USERDATA_DIR_PREFIX);
+        const char *home = getenv("XDG_CONFIG_HOME");
+        if (home == NULL)
+            snprintf(path, sizeof(path),
+                     "%s/.config/%s", getenv("HOME"),
+                     SUNPINYIN_USERDATA_DIR_PREFIX);
+        else
+            snprintf(path, sizeof(path),
+                     "%s/%s", home,
+                     SUNPINYIN_USERDATA_DIR_PREFIX);
         m_user_data_dir = path;
     }
 
--- src/ime-core/imi_options.h.orig	2014-11-14 14:17:48 UTC
+++ src/ime-core/imi_options.h
@@ -52,7 +52,7 @@
 #include "pinyin/hunpin_seg.h"
 
 #ifndef SUNPINYIN_USERDATA_DIR_PREFIX
-#define SUNPINYIN_USERDATA_DIR_PREFIX ".sunpinyin"
+#define SUNPINYIN_USERDATA_DIR_PREFIX "sunpinyin"
 #endif
 
 struct CSimplifiedChinesePolicy : public IConfigurable {
