[PATCH app/setxkbmap] Add $HOME/.xkb to default search path

Mihail Konev k.mvc at ya.ru
Thu Nov 17 02:39:42 UTC 2016


Signed-off-by: Mihail Konev <k.mvc at ya.ru>
BugLink: https://github.com/xkbcommon/libxkbcommon/issues/40
---
 setxkbmap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/setxkbmap.c b/setxkbmap.c
index cf0f02d6e704..f5b9f637a136 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -50,6 +50,9 @@
 #ifndef DFLT_XKB_CONFIG_ROOT
 #define DFLT_XKB_CONFIG_ROOT "/usr/share/X11/xkb"
 #endif
+#ifndef DFLT_XKB_CONFIG_HOME
+#define DFLT_XKB_CONFIG_HOME ".xkb"
+#endif
 #ifndef DFLT_XKB_RULES_FILE
 #define DFLT_XKB_RULES_FILE "base"
 #endif
@@ -394,6 +397,12 @@ parseArgs(int argc, char **argv)
 
     ok = True;
     addToList(&inclPath, ".");
+    {
+        char *homepath = getenv("HOME");
+        char *home_incl_path = malloc(strlen(homepath) + 1 + strlen(DFLT_XKB_CONFIG_HOME) + 1);
+        sprintf(home_incl_path, "%s/%s", homepath, DFLT_XKB_CONFIG_HOME);
+        addToList(&inclPath, home_incl_path);
+    }
     addToList(&inclPath, DFLT_XKB_CONFIG_ROOT);
     for (i = 1; (i < argc) && ok; i++)
     {
-- 
2.9.2



More information about the xorg-devel mailing list