%H:
The value of the HOME environment variable.
+ %E:
+ The extra lookup path for system-wide XKB data (usually /etc/xkb/rules).
+
%S:
The system-installed rules directory (usually /usr/share/X11/xkb/rules).
```
- `$XDG_CONFIG_HOME/xkb/`, or `$HOME/.config/xkb/` if the `$XDG_CONFIG_HOME`
environment variable is not defined
- `$HOME/.xkb/`
+- `$XKB_CONFIG_EXTRA_PATH` if set, otherswise `<sysconfdir>/xkb` (on most
+ distributions this is `/etc/xkb`)
- `$XKB_CONFIG_ROOT` if set, otherwise `<datadir>/X11/xkb/` (path defined by the
`xkeyboard-config` package, on most distributions this is
`/usr/share/X11/xkb`)
endif
endif
+XKBCONFIGEXTRAPATH = get_option('xkb-config-extra-path')
+if XKBCONFIGEXTRAPATH == ''
+ XKBCONFIGEXTRAPATH = join_paths(get_option('prefix'), get_option('sysconfdir'), 'xkb')
+endif
# The X locale directory for compose.
XLOCALEDIR = get_option('x-locale-root')
configh_data.set(system_extensions, 1)
system_ext_define = '#define ' + system_extensions
configh_data.set_quoted('DFLT_XKB_CONFIG_ROOT', XKBCONFIGROOT)
+configh_data.set_quoted('DFLT_XKB_CONFIG_EXTRA_PATH', XKBCONFIGEXTRAPATH)
configh_data.set_quoted('XLOCALEDIR', XLOCALEDIR)
configh_data.set_quoted('DEFAULT_XKB_RULES', get_option('default-rules'))
configh_data.set_quoted('DEFAULT_XKB_MODEL', get_option('default-model'))
description: 'The XKB config root [default=xkeyboard-config install path]',
)
option(
+ 'xkb-config-extra-path',
+ type: 'string',
+ description: 'Extra lookup path for system-wide XKB data [default=$sysconfdir/xkb]',
+)
+option(
'x-locale-root',
type: 'string',
description: 'The X locale root [default=$datadir/X11/locale]',
}
const char *
+xkb_context_include_path_get_extra_path(struct xkb_context *ctx)
+{
+ const char *extra = secure_getenv("XKB_CONFIG_EXTRA_PATH");
+ return extra ? extra : DFLT_XKB_CONFIG_EXTRA_PATH;
+}
+
+const char *
xkb_context_include_path_get_system_path(struct xkb_context *ctx)
{
const char *root = secure_getenv("XKB_CONFIG_ROOT");
XKB_EXPORT int
xkb_context_include_path_append_default(struct xkb_context *ctx)
{
- const char *home, *xdg, *root;
+ const char *home, *xdg, *root, *extra;
char *user_path;
int ret = 0;
}
}
+ extra = xkb_context_include_path_get_extra_path(ctx);
+ ret |= xkb_context_include_path_append(ctx, extra);
root = xkb_context_include_path_get_system_path(ctx);
ret |= xkb_context_include_path_append(ctx, root);
unsigned int idx);
const char *
+xkb_context_include_path_get_extra_path(struct xkb_context *ctx);
+
+const char *
xkb_context_include_path_get_system_path(struct xkb_context *ctx);
/*
XKB_EXPORT bool
rxkb_context_include_path_append_default(struct rxkb_context *ctx)
{
- const char *home, *xdg, *root;
+ const char *home, *xdg, *root, *extra;
char *user_path;
bool ret = false;
}
}
+ extra = secure_getenv("XKB_CONFIG_EXTRA_PATH");
+ if (extra != NULL)
+ ret |= rxkb_context_include_path_append(ctx, extra);
+ else
+ ret |= rxkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_EXTRA_PATH);
+
root = secure_getenv("XKB_CONFIG_ROOT");
if (root != NULL)
ret |= rxkb_context_include_path_append(ctx, root);
return;
}
}
+ else if (chr(&s, 'E')) {
+ const char *default_root = xkb_context_include_path_get_extra_path(m->ctx);
+ if (!buf_appends(&s, default_root) || !buf_appends(&s, "/rules")) {
+ scanner_err(&s, "include path after expanding %%E is too long");
+ return;
+ }
+ }
else {
scanner_err(&s, "unknown %% format (%c) in include statement", peek(&s));
return;
# to override it with a known (empty) directory. Otherwise our test
# behavior depends on the system the test is run on.
os.environ['XDG_CONFIG_HOME'] = tmpdir
+ # This needs to be separated if we do specific extra path testing
+ os.environ['XKB_CONFIG_EXTRA_PATH'] = tmpdir
sys.exit(pytest.main(args=[__file__]))
*
* The user may set some environment variables which affect the library:
*
- * - `XKB_CONFIG_ROOT`, `XDG_CONFIG_DIR`, `HOME` - see @ref include-path.
+ * - `XKB_CONFIG_ROOT`, `XKB_EXTRA_PATH`, `XDG_CONFIG_DIR`, `HOME` - see @ref include-path.
* - `XKB_LOG_LEVEL` - see xkb_context_set_log_level().
* - `XKB_LOG_VERBOSITY` - see xkb_context_set_log_verbosity().
* - `XKB_DEFAULT_RULES`, `XKB_DEFAULT_MODEL`, `XKB_DEFAULT_LAYOUT`,
* fallback to `$HOME/.config/` if unset.
* - The path `$HOME/.xkb`, where $HOME is the value of the environment
* variable `HOME`.
+ * - The `XKB_EXTRA_PATH` environment variable, if defined, otherwise the
+ * system configuration directory, defined at library configuration time
+ * (usually `/etc/xkb`).
* - The `XKB_CONFIG_ROOT` environment variable, if defined, otherwise
* the system XKB root, defined at library configuration time.
*