From 29e80e7b7608961a9400eaa10880c4a25e5e3726 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Jul 2020 13:30:47 +1000 Subject: tools: install our tools as xkbcli subcommands The xkbcli tool usage help is ifdef'd out where the tool isn't built but the man page always includes all tools. Easier that way. Signed-off-by: Peter Hutterer --- tools/compile-keymap.c | 342 ++++++++++++++++++++++++++++++++ tools/rmlvo-to-keymap.c | 342 -------------------------------- tools/xkbcli-compile-keymap.1.ronn | 63 ++++++ tools/xkbcli-how-to-type.1.ronn | 36 ++++ tools/xkbcli-interactive-evdev.1.ronn | 59 ++++++ tools/xkbcli-interactive-wayland.1.ronn | 28 +++ tools/xkbcli-interactive-x11.1.ronn | 28 +++ tools/xkbcli-list.1.ronn | 36 ++++ tools/xkbcli.1.ronn | 22 ++ tools/xkbcli.c | 33 ++- 10 files changed, 646 insertions(+), 343 deletions(-) create mode 100644 tools/compile-keymap.c delete mode 100644 tools/rmlvo-to-keymap.c create mode 100644 tools/xkbcli-compile-keymap.1.ronn create mode 100644 tools/xkbcli-how-to-type.1.ronn create mode 100644 tools/xkbcli-interactive-evdev.1.ronn create mode 100644 tools/xkbcli-interactive-wayland.1.ronn create mode 100644 tools/xkbcli-interactive-x11.1.ronn create mode 100644 tools/xkbcli-list.1.ronn (limited to 'tools') diff --git a/tools/compile-keymap.c b/tools/compile-keymap.c new file mode 100644 index 0000000..e090de1 --- /dev/null +++ b/tools/compile-keymap.c @@ -0,0 +1,342 @@ +/* + * Copyright © 2018 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "xkbcomp/xkbcomp-priv.h" +#include "xkbcomp/rules.h" +#include "xkbcommon/xkbcommon.h" + +#define DEFAULT_INCLUDE_PATH_PLACEHOLDER "__defaults__" + +static bool verbose = false; +static enum output_format { + FORMAT_RMLVO, + FORMAT_KEYMAP, + FORMAT_KCCGST, + FORMAT_KEYMAP_FROM_XKB, +} output_format = FORMAT_KEYMAP; +static darray(const char *) includes; + +static void +usage(char **argv) +{ + printf("Usage: %s [OPTIONS]\n" + "\n" + "Compile the given RMLVO to a keymap and print it\n" + "\n" + "Options:\n" + " --verbose\n" + " Enable verbose debugging output\n" + " --kccgst\n" + " Print a keymap which only includes the KcCGST component names instead of the full keymap\n" + " --rmlvo\n" + " Print the full RMLVO with the defaults filled in for missing elements\n" + " --from-xkb\n" + " Load the XKB file from stdin, ignore RMLVO options. This option\n" + " must not be used with --kccgst.\n" + " --include\n" + " Add the given path to the include path list. This option is\n" + " order-dependent, include paths given first are searched first.\n" + " If an include path is given, the default include path list is\n" + " not used. Use --include-defaults to add the default include\n" + " paths\n" + " --include-defaults\n" + " Add the default set of include directories.\n" + " This option is order-dependent, include paths given first\n" + " are searched first.\n" + "\n" + "XKB-specific options:\n" + " --rules \n" + " The XKB ruleset (default: '%s')\n" + " --model \n" + " The XKB model (default: '%s')\n" + " --layout \n" + " The XKB layout (default: '%s')\n" + " --variant \n" + " The XKB layout variant (default: '%s')\n" + " --options \n" + " The XKB options (default: '%s')\n" + "\n", + argv[0], DEFAULT_XKB_RULES, + DEFAULT_XKB_MODEL, DEFAULT_XKB_LAYOUT, + DEFAULT_XKB_VARIANT ? DEFAULT_XKB_VARIANT : "", + DEFAULT_XKB_OPTIONS ? DEFAULT_XKB_OPTIONS : ""); +} + +static bool +parse_options(int argc, char **argv, struct xkb_rule_names *names) +{ + enum options { + OPT_VERBOSE, + OPT_KCCGST, + OPT_RMLVO, + OPT_FROM_XKB, + OPT_INCLUDE, + OPT_INCLUDE_DEFAULTS, + OPT_RULES, + OPT_MODEL, + OPT_LAYOUT, + OPT_VARIANT, + OPT_OPTION, + }; + static struct option opts[] = { + {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, OPT_VERBOSE}, + {"kccgst", no_argument, 0, OPT_KCCGST}, + {"rmlvo", no_argument, 0, OPT_RMLVO}, + {"from-xkb", no_argument, 0, OPT_FROM_XKB}, + {"include", required_argument, 0, OPT_INCLUDE}, + {"include-defaults", no_argument, 0, OPT_INCLUDE_DEFAULTS}, + {"rules", required_argument, 0, OPT_RULES}, + {"model", required_argument, 0, OPT_MODEL}, + {"layout", required_argument, 0, OPT_LAYOUT}, + {"variant", required_argument, 0, OPT_VARIANT}, + {"options", required_argument, 0, OPT_OPTION}, + {0, 0, 0, 0}, + }; + + while (1) { + int c; + int option_index = 0; + c = getopt_long(argc, argv, "h", opts, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + usage(argv); + exit(0); + case OPT_VERBOSE: + verbose = true; + break; + case OPT_KCCGST: + output_format = FORMAT_KCCGST; + break; + case OPT_RMLVO: + output_format = FORMAT_RMLVO; + break; + case OPT_FROM_XKB: + output_format = FORMAT_KEYMAP_FROM_XKB; + break; + case OPT_INCLUDE: + darray_append(includes, optarg); + break; + case OPT_INCLUDE_DEFAULTS: + darray_append(includes, DEFAULT_INCLUDE_PATH_PLACEHOLDER); + break; + case OPT_RULES: + names->rules = optarg; + break; + case OPT_MODEL: + names->model = optarg; + break; + case OPT_LAYOUT: + names->layout = optarg; + break; + case OPT_VARIANT: + names->variant = optarg; + break; + case OPT_OPTION: + names->options = optarg; + break; + default: + usage(argv); + exit(1); + } + + } + + return true; +} + +static bool +print_rmlvo(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) +{ + printf("rules: \"%s\"\nmodel: \"%s\"\nlayout: \"%s\"\nvariant: \"%s\"\noptions: \"%s\"\n", + rmlvo->rules, rmlvo->model, rmlvo->layout, + rmlvo->variant ? rmlvo->variant : "", + rmlvo->options ? rmlvo->options : ""); + return true; +} + +static bool +print_kccgst(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) +{ + struct xkb_component_names kccgst; + + if (!xkb_components_from_rules(ctx, rmlvo, &kccgst)) + return false; + + printf("xkb_keymap {\n" + " xkb_keycodes { include \"%s\" };\n" + " xkb_types { include \"%s\" };\n" + " xkb_compat { include \"%s\" };\n" + " xkb_symbols { include \"%s\" };\n" + "};\n", + kccgst.keycodes, kccgst.types, kccgst.compat, kccgst.symbols); + free(kccgst.keycodes); + free(kccgst.types); + free(kccgst.compat); + free(kccgst.symbols); + + return true; +} + +static bool +print_keymap(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) +{ + struct xkb_keymap *keymap; + + keymap = xkb_keymap_new_from_names(ctx, rmlvo, XKB_KEYMAP_COMPILE_NO_FLAGS); + if (keymap == NULL) + return false; + + printf("%s\n", xkb_keymap_get_as_string(keymap, + XKB_KEYMAP_FORMAT_TEXT_V1)); + xkb_keymap_unref(keymap); + return true; +} + +static bool +print_keymap_from_file(struct xkb_context *ctx) +{ + struct xkb_keymap *keymap = NULL; + char *keymap_string = NULL; + FILE *file = NULL; + bool success = false; + + file = tmpfile(); + if (!file) { + fprintf(stderr, "Failed to create tmpfile\n"); + goto out; + } + + while (true) { + char buf[4096]; + size_t len; + + len = fread(buf, 1, sizeof(buf), stdin); + if (ferror(stdin)) { + fprintf(stderr, "Failed to read from stdin\n"); + goto out; + } + if (len > 0) { + size_t wlen = fwrite(buf, 1, len, file); + if (wlen != len) { + fprintf(stderr, "Failed to write to tmpfile\n"); + goto out; + } + } + if (feof(stdin)) + break; + } + fseek(file, 0, SEEK_SET); + keymap = xkb_keymap_new_from_file(ctx, file, + XKB_KEYMAP_FORMAT_TEXT_V1, 0); + if (!keymap) { + fprintf(stderr, "Couldn't create xkb keymap\n"); + goto out; + } + + keymap_string = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1); + if (!keymap_string) { + fprintf(stderr, "Couldn't get the keymap string\n"); + goto out; + } + + fputs(keymap_string, stdout); + success = true; + +out: + if (file) + fclose(file); + xkb_keymap_unref(keymap); + free(keymap_string); + + return success; +} + +int +main(int argc, char **argv) +{ + struct xkb_context *ctx; + struct xkb_rule_names names = { + .rules = NULL, + .model = NULL, + .layout = NULL, + .variant = NULL, + .options = NULL, + }; + int rc = 1; + const char **path; + + if (argc <= 1) { + usage(argv); + return 1; + } + + if (!parse_options(argc, argv, &names)) + return 1; + + ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES); + assert(ctx); + + if (verbose) { + xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG); + xkb_context_set_log_verbosity(ctx, 10); + } + + xkb_context_sanitize_rule_names(ctx, &names); + if (darray_empty(includes)) + darray_append(includes, DEFAULT_INCLUDE_PATH_PLACEHOLDER); + + darray_foreach(path, includes) { + if (streq(*path, DEFAULT_INCLUDE_PATH_PLACEHOLDER)) + xkb_context_include_path_append_default(ctx); + else + xkb_context_include_path_append(ctx, *path); + } + + if (output_format == FORMAT_RMLVO) { + rc = print_rmlvo(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; + } else if (output_format == FORMAT_KEYMAP) { + rc = print_keymap(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; + } else if (output_format == FORMAT_KCCGST) { + rc = print_kccgst(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; + } else if (output_format == FORMAT_KEYMAP_FROM_XKB) { + rc = print_keymap_from_file(ctx); + } + + xkb_context_unref(ctx); + + return rc; +} diff --git a/tools/rmlvo-to-keymap.c b/tools/rmlvo-to-keymap.c deleted file mode 100644 index e090de1..0000000 --- a/tools/rmlvo-to-keymap.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright © 2018 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "xkbcomp/xkbcomp-priv.h" -#include "xkbcomp/rules.h" -#include "xkbcommon/xkbcommon.h" - -#define DEFAULT_INCLUDE_PATH_PLACEHOLDER "__defaults__" - -static bool verbose = false; -static enum output_format { - FORMAT_RMLVO, - FORMAT_KEYMAP, - FORMAT_KCCGST, - FORMAT_KEYMAP_FROM_XKB, -} output_format = FORMAT_KEYMAP; -static darray(const char *) includes; - -static void -usage(char **argv) -{ - printf("Usage: %s [OPTIONS]\n" - "\n" - "Compile the given RMLVO to a keymap and print it\n" - "\n" - "Options:\n" - " --verbose\n" - " Enable verbose debugging output\n" - " --kccgst\n" - " Print a keymap which only includes the KcCGST component names instead of the full keymap\n" - " --rmlvo\n" - " Print the full RMLVO with the defaults filled in for missing elements\n" - " --from-xkb\n" - " Load the XKB file from stdin, ignore RMLVO options. This option\n" - " must not be used with --kccgst.\n" - " --include\n" - " Add the given path to the include path list. This option is\n" - " order-dependent, include paths given first are searched first.\n" - " If an include path is given, the default include path list is\n" - " not used. Use --include-defaults to add the default include\n" - " paths\n" - " --include-defaults\n" - " Add the default set of include directories.\n" - " This option is order-dependent, include paths given first\n" - " are searched first.\n" - "\n" - "XKB-specific options:\n" - " --rules \n" - " The XKB ruleset (default: '%s')\n" - " --model \n" - " The XKB model (default: '%s')\n" - " --layout \n" - " The XKB layout (default: '%s')\n" - " --variant \n" - " The XKB layout variant (default: '%s')\n" - " --options \n" - " The XKB options (default: '%s')\n" - "\n", - argv[0], DEFAULT_XKB_RULES, - DEFAULT_XKB_MODEL, DEFAULT_XKB_LAYOUT, - DEFAULT_XKB_VARIANT ? DEFAULT_XKB_VARIANT : "", - DEFAULT_XKB_OPTIONS ? DEFAULT_XKB_OPTIONS : ""); -} - -static bool -parse_options(int argc, char **argv, struct xkb_rule_names *names) -{ - enum options { - OPT_VERBOSE, - OPT_KCCGST, - OPT_RMLVO, - OPT_FROM_XKB, - OPT_INCLUDE, - OPT_INCLUDE_DEFAULTS, - OPT_RULES, - OPT_MODEL, - OPT_LAYOUT, - OPT_VARIANT, - OPT_OPTION, - }; - static struct option opts[] = { - {"help", no_argument, 0, 'h'}, - {"verbose", no_argument, 0, OPT_VERBOSE}, - {"kccgst", no_argument, 0, OPT_KCCGST}, - {"rmlvo", no_argument, 0, OPT_RMLVO}, - {"from-xkb", no_argument, 0, OPT_FROM_XKB}, - {"include", required_argument, 0, OPT_INCLUDE}, - {"include-defaults", no_argument, 0, OPT_INCLUDE_DEFAULTS}, - {"rules", required_argument, 0, OPT_RULES}, - {"model", required_argument, 0, OPT_MODEL}, - {"layout", required_argument, 0, OPT_LAYOUT}, - {"variant", required_argument, 0, OPT_VARIANT}, - {"options", required_argument, 0, OPT_OPTION}, - {0, 0, 0, 0}, - }; - - while (1) { - int c; - int option_index = 0; - c = getopt_long(argc, argv, "h", opts, &option_index); - if (c == -1) - break; - - switch (c) { - case 'h': - usage(argv); - exit(0); - case OPT_VERBOSE: - verbose = true; - break; - case OPT_KCCGST: - output_format = FORMAT_KCCGST; - break; - case OPT_RMLVO: - output_format = FORMAT_RMLVO; - break; - case OPT_FROM_XKB: - output_format = FORMAT_KEYMAP_FROM_XKB; - break; - case OPT_INCLUDE: - darray_append(includes, optarg); - break; - case OPT_INCLUDE_DEFAULTS: - darray_append(includes, DEFAULT_INCLUDE_PATH_PLACEHOLDER); - break; - case OPT_RULES: - names->rules = optarg; - break; - case OPT_MODEL: - names->model = optarg; - break; - case OPT_LAYOUT: - names->layout = optarg; - break; - case OPT_VARIANT: - names->variant = optarg; - break; - case OPT_OPTION: - names->options = optarg; - break; - default: - usage(argv); - exit(1); - } - - } - - return true; -} - -static bool -print_rmlvo(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) -{ - printf("rules: \"%s\"\nmodel: \"%s\"\nlayout: \"%s\"\nvariant: \"%s\"\noptions: \"%s\"\n", - rmlvo->rules, rmlvo->model, rmlvo->layout, - rmlvo->variant ? rmlvo->variant : "", - rmlvo->options ? rmlvo->options : ""); - return true; -} - -static bool -print_kccgst(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) -{ - struct xkb_component_names kccgst; - - if (!xkb_components_from_rules(ctx, rmlvo, &kccgst)) - return false; - - printf("xkb_keymap {\n" - " xkb_keycodes { include \"%s\" };\n" - " xkb_types { include \"%s\" };\n" - " xkb_compat { include \"%s\" };\n" - " xkb_symbols { include \"%s\" };\n" - "};\n", - kccgst.keycodes, kccgst.types, kccgst.compat, kccgst.symbols); - free(kccgst.keycodes); - free(kccgst.types); - free(kccgst.compat); - free(kccgst.symbols); - - return true; -} - -static bool -print_keymap(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) -{ - struct xkb_keymap *keymap; - - keymap = xkb_keymap_new_from_names(ctx, rmlvo, XKB_KEYMAP_COMPILE_NO_FLAGS); - if (keymap == NULL) - return false; - - printf("%s\n", xkb_keymap_get_as_string(keymap, - XKB_KEYMAP_FORMAT_TEXT_V1)); - xkb_keymap_unref(keymap); - return true; -} - -static bool -print_keymap_from_file(struct xkb_context *ctx) -{ - struct xkb_keymap *keymap = NULL; - char *keymap_string = NULL; - FILE *file = NULL; - bool success = false; - - file = tmpfile(); - if (!file) { - fprintf(stderr, "Failed to create tmpfile\n"); - goto out; - } - - while (true) { - char buf[4096]; - size_t len; - - len = fread(buf, 1, sizeof(buf), stdin); - if (ferror(stdin)) { - fprintf(stderr, "Failed to read from stdin\n"); - goto out; - } - if (len > 0) { - size_t wlen = fwrite(buf, 1, len, file); - if (wlen != len) { - fprintf(stderr, "Failed to write to tmpfile\n"); - goto out; - } - } - if (feof(stdin)) - break; - } - fseek(file, 0, SEEK_SET); - keymap = xkb_keymap_new_from_file(ctx, file, - XKB_KEYMAP_FORMAT_TEXT_V1, 0); - if (!keymap) { - fprintf(stderr, "Couldn't create xkb keymap\n"); - goto out; - } - - keymap_string = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1); - if (!keymap_string) { - fprintf(stderr, "Couldn't get the keymap string\n"); - goto out; - } - - fputs(keymap_string, stdout); - success = true; - -out: - if (file) - fclose(file); - xkb_keymap_unref(keymap); - free(keymap_string); - - return success; -} - -int -main(int argc, char **argv) -{ - struct xkb_context *ctx; - struct xkb_rule_names names = { - .rules = NULL, - .model = NULL, - .layout = NULL, - .variant = NULL, - .options = NULL, - }; - int rc = 1; - const char **path; - - if (argc <= 1) { - usage(argv); - return 1; - } - - if (!parse_options(argc, argv, &names)) - return 1; - - ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES); - assert(ctx); - - if (verbose) { - xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG); - xkb_context_set_log_verbosity(ctx, 10); - } - - xkb_context_sanitize_rule_names(ctx, &names); - if (darray_empty(includes)) - darray_append(includes, DEFAULT_INCLUDE_PATH_PLACEHOLDER); - - darray_foreach(path, includes) { - if (streq(*path, DEFAULT_INCLUDE_PATH_PLACEHOLDER)) - xkb_context_include_path_append_default(ctx); - else - xkb_context_include_path_append(ctx, *path); - } - - if (output_format == FORMAT_RMLVO) { - rc = print_rmlvo(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; - } else if (output_format == FORMAT_KEYMAP) { - rc = print_keymap(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; - } else if (output_format == FORMAT_KCCGST) { - rc = print_kccgst(ctx, &names) ? EXIT_SUCCESS : EXIT_FAILURE; - } else if (output_format == FORMAT_KEYMAP_FROM_XKB) { - rc = print_keymap_from_file(ctx); - } - - xkb_context_unref(ctx); - - return rc; -} diff --git a/tools/xkbcli-compile-keymap.1.ronn b/tools/xkbcli-compile-keymap.1.ronn new file mode 100644 index 0000000..8b0c74a --- /dev/null +++ b/tools/xkbcli-compile-keymap.1.ronn @@ -0,0 +1,63 @@ +# xkbcli-compile-keymap(1) - compile an XKB keymap + +## SYNOPSIS + +**xkbcli** compile-keymap \[--help\] \[OPTIONS\] + +## DESCRIPTION + +**xkbcli compile-keymap** compiles and prints a keymap based on the given +options. + +## OPTIONS + + * `--help`: + Print help and exit + + * `--verbose`: + Enable verbose debugging output + + * `--kccgst`: + Print a keymap which only includes the KcCGST component names instead of + the full keymap + + * ` --rmlvo`: + Print the full RMLVO with the defaults filled in for missing elements + + * ` --from-xkb`: + Load the XKB file from stdin, ignore RMLVO options. This option must not + be used with `--kccgst`. + + * ` --include`: + Add the given path to the include path list. This option is + order-dependent, include paths given first are searched first. + If an include path is given, the default include path list is + not used. Use `--include-defaults` to add the default include + paths + + * ` --include-defaults`: + Add the default set of include directories. + This option is order-dependent, include paths given first + are searched first. + + * ` --rules `: + The XKB ruleset + + * ` --model `: + The XKB model + * ` --layout `: + + The XKB layout + * ` --variant `: + + The XKB layout variant + + * ` --options `: + The XKB options + +## SEE ALSO + +**xkbcli**(1) + +The libxkbcommon online documentation at + diff --git a/tools/xkbcli-how-to-type.1.ronn b/tools/xkbcli-how-to-type.1.ronn new file mode 100644 index 0000000..f89ca76 --- /dev/null +++ b/tools/xkbcli-how-to-type.1.ronn @@ -0,0 +1,36 @@ +# xkbcli-how-to-type(1) - query how to type a given Unicode codepoint + +## SYNOPSIS + +**xkbcli** how-to-type \[OPTIONS\] <codepoint> + +## DESCRIPTION + +**xkbcli how-to-type** prints key sequences to type the given Unicode +codepoint. + +Pipe into `column -ts $'\\t'` for nicely aligned output. + +## OPTIONS + + * ` -r `: + The XKB ruleset + + * ` -m `: + The XKB model + + * `-l `: + The XKB layout + + * `-v `: + The XKB layout variant + + * `-o `: + The XKB options + +## SEE ALSO + +**xkbcli**(1) + +The libxkbcommon online documentation at + diff --git a/tools/xkbcli-interactive-evdev.1.ronn b/tools/xkbcli-interactive-evdev.1.ronn new file mode 100644 index 0000000..b3d98f4 --- /dev/null +++ b/tools/xkbcli-interactive-evdev.1.ronn @@ -0,0 +1,59 @@ +# xkbcli-interactive-evdev(1) - interactive debugger for XKB maps + +## SYNOPSIS + +**xkbcli** interactive-evdev \[--help\] \[OPTIONS\] + +## DESCRIPTION + +**xkbcli interactive-evdev** is a commandline tool to interactively +debug XKB maps by listening to `/dev/input/eventX` evdev devices. + +This is a debugging tool, its behavior or output is not guaranteed to be +stable. + +## OPTIONS + + * `--help`: + Print help and exit + + * `-r`: + Specify the XKB ruleset + + * `-m`: + Specify the XKB model + + * `-l`: + Specify the XKB layout + + * `-v`: + Specify the XKB variant + + * `-o`: + Specify the XKB options + + * `-k`: + Specify a keymap path. This option is mutually exclusive with the rmlvo + options. + + * `-n`: + Specify an evdev keycode offset. + + * `-c`: + Report changes to the keyboard state + + * `-d`: + Enable compose functionality + + * `-g`: + Use GTK consumed mode + + +## SEE ALSO + +**xkbcli**(1), +**xkbcli-interactive-wayland**(1), **xkbcli-interactive-x11**(1) + +The libxkbcommon online documentation at + + diff --git a/tools/xkbcli-interactive-wayland.1.ronn b/tools/xkbcli-interactive-wayland.1.ronn new file mode 100644 index 0000000..929f766 --- /dev/null +++ b/tools/xkbcli-interactive-wayland.1.ronn @@ -0,0 +1,28 @@ +# xkbcli-interactive-wayland(1) - interactive debugger for XKB maps + +## SYNOPSIS + +**xkbcli** interactive-wayland \[--help\] \[OPTIONS\] + +## DESCRIPTION + +**xkbcli interactive-wayland** is a commandline tool to interactively +debug XKB maps by listening to wayland events. This requires a Wayland +compositor to be running. + +This is a debugging tool, its behavior or output is not guaranteed to be +stable. + +## OPTIONS + + * `--help`: + Print help and exit + +## SEE ALSO + +**xkbcli**(1), **xkbcli-interactive-evdev**(1), +**xkbcli-interactive-x11**(1) + +The libxkbcommon online documentation at + + diff --git a/tools/xkbcli-interactive-x11.1.ronn b/tools/xkbcli-interactive-x11.1.ronn new file mode 100644 index 0000000..f7b27f0 --- /dev/null +++ b/tools/xkbcli-interactive-x11.1.ronn @@ -0,0 +1,28 @@ +# xkbcli-interactive-x11(1) - interactive debugger for XKB maps + +## SYNOPSIS + +**xkbcli** interactive-x11 \[--help\] \[OPTIONS\] + +## DESCRIPTION + +**xkbcli interactive-x11** is a commandline tool to interactively +debug XKB maps by listening to X11 events. This requires an X server to be +running. + +This is a debugging tool, its behavior or output is not guaranteed to be +stable. + +## OPTIONS + + * `--help`: + Print help and exit + +## SEE ALSO + +**xkbcli**(1), **xkbcli-interactive-evdev**(1), +**xkbcli-interactive-wayland**(1) + +The libxkbcommon online documentation at + + diff --git a/tools/xkbcli-list.1.ronn b/tools/xkbcli-list.1.ronn new file mode 100644 index 0000000..7681df0 --- /dev/null +++ b/tools/xkbcli-list.1.ronn @@ -0,0 +1,36 @@ +# xkbcli-list(1) - list available XKB rules, models, layouts, variants and options + +## SYNOPSIS + +**xkbcli** list [--help] [/path/to/xkbbase [/path/to/xkbbase] ...] + +## DESCRIPTION + +**xkbcli list** is a commandline tool to list available model, layout, variant +and option (MLVO) values from the XKB registry. + +Arguments provided on the commandline are treated as XKB base directory +installations. + +## OPTIONS + + * `--help`: + Print help and exit + + * `-v, --verbose`: + Increase verbosity, use multiple times for debugging output + + * `--ruleset `: + Load the ruleset with the given name + + * `--skip-default-paths`: + Do not load the default XKB include paths + + * `--load-exotic`: + Load exotic (extra) layouts + +## SEE ALSO + +**xkbcli**(1) + +The libxkbcommon online documentation at diff --git a/tools/xkbcli.1.ronn b/tools/xkbcli.1.ronn index 8e2c338..b6a98f0 100644 --- a/tools/xkbcli.1.ronn +++ b/tools/xkbcli.1.ronn @@ -17,6 +17,28 @@ layouts and other elements. * `--version`: Print the version and exit +## COMMANDS + + * `how-to-type`: + Show how to type a given unicode codepoint, see + `xkbcli-how-to-type`(1) + + * `interactive-x11`: + Interactive debugger for XKB maps for X11, see `xbkcli-interactive-x11`(1) + + * `interactive-wayland`: + Interactive debugger for XKB maps for Wayland, see + `xkbcli-interactive-wayland`(1) + + * `interactive-evdev`: + Interactive debugger for XKB maps for evdev, see + `xkbcli-interactive-evdev` + + * `list`: + List available layouts and more, see `xkbcli-list`(1) + +Note that not all tools may be available on your system. + ## EXIT STATUS * 0: diff --git a/tools/xkbcli.c b/tools/xkbcli.c index fbab9dd..fe6b6b5 100644 --- a/tools/xkbcli.c +++ b/tools/xkbcli.c @@ -37,7 +37,38 @@ usage(void) "Global options:\n" " -h, --help ...... show this help and exit\n" " -V, --version ... show version information and exit\n" - "\n"); + "Commands:\n" +#if HAVE_XKBCLI_LIST + " list\n" + " List available rules, models, layouts, variants and options\n" + "\n" +#endif +#if HAVE_XKBCLI_INTERACTIVE_WAYLAND + " interactive-wayland\n" + " Interactive debugger for XKB maps for wayland\n" + "\n" +#endif +#if HAVE_XKBCLI_INTERACTIVE_x11 + " interactive-x11\n" + " Interactive debugger for XKB maps for X11\n" + "\n" +#endif +#if HAVE_XKBCLI_INTERACTIVE_EVDEV + " interactive-evdev\n" + " Interactive debugger for XKB maps for evdev\n" + "\n" +#endif +#if HAVE_XKBCLI_COMPILE_KEYMAP + " compile-keymap\n" + " Compile n XKB keymap\n" + "\n" +#endif +#if HAVE_XKBCLI_HOW_TO_TYPE + " how-to-type\n" + " Print key sequences to type a Unicode codepoint\n" + "\n" +#endif + ); } int -- cgit v1.2.1