+ home = xkb_context_getenv(ctx, "HOME");
+
+ xdg = xkb_context_getenv(ctx, "XDG_CONFIG_HOME");
+ if (xdg != NULL) {
+ user_path = asprintf_safe("%s/xkb", xdg);
+ if (user_path) {
+ ret |= xkb_context_include_path_append(ctx, user_path);
+ free(user_path);
+ }
+ } else if (home != NULL) {
+ /* XDG_CONFIG_HOME fallback is $HOME/.config/ */
+ user_path = asprintf_safe("%s/.config/xkb", home);
+ if (user_path) {
+ ret |= xkb_context_include_path_append(ctx, user_path);
+ free(user_path);
+ }
+ }
+
+ if (home != NULL) {
+ user_path = asprintf_safe("%s/.xkb", home);
+ if (user_path) {
+ ret |= xkb_context_include_path_append(ctx, user_path);
+ free(user_path);
+ }
+ }