From 29e80e7b7608961a9400eaa10880c4a25e5e3726 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Jul 2020 13:30:47 +1000 Subject: [PATCH] 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 --- meson.build | 49 +++++++++++++++++---- test/xkeyboard-config-test.py.in | 3 +- tools/{rmlvo-to-keymap.c => compile-keymap.c} | 0 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 +++++++++++++- 11 files changed, 347 insertions(+), 10 deletions(-) rename tools/{rmlvo-to-keymap.c => compile-keymap.c} (100%) 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 diff --git a/meson.build b/meson.build index 7b584c5..8de5928 100644 --- a/meson.build +++ b/meson.build @@ -310,6 +310,8 @@ You can disable X11 support with -Denable-x11=false.''') ) endif +man_pages = [] + # libxkbregistry if get_option('enable-xkbregistry') dep_libxml = dependency('libxml-2.0') @@ -548,11 +550,29 @@ if build_tools man_pages += 'tools/xkbcli.1.ronn' if have_getopt_long - executable('xkbcommon-rmlvo-to-keymap', 'tools/rmlvo-to-keymap.c', dependencies: tools_dep) - executable('xkbcommon-how-to-type', 'tools/how-to-type.c', dependencies: tools_dep) + executable('xkbcli-compile-keymap', + 'tools/compile-keymap.c', + dependencies: tools_dep, + install: true, + install_dir: dir_libexec) + man_pages += 'tools/xkbcli-compile-keymap.1.ronn' + configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true) + executable('xkbcli-how-to-type', + 'tools/how-to-type.c', + dependencies: tools_dep, + install: true, + install_dir: dir_libexec) + man_pages += 'tools/xkbcli-how-to-type.1.ronn' + configh_data.set10('HAVE_XKBCLI_HOW_TO_TYPE', true) endif if cc.has_header('linux/input.h') - executable('xkbcommon-interactive-evdev', 'tools/interactive-evdev.c', dependencies: tools_dep) + executable('xkbcli-interactive-evdev', + 'tools/interactive-evdev.c', + dependencies: tools_dep, + install: true, + install_dir: dir_libexec) + configh_data.set10('HAVE_XKBCLI_INTERACTIVE_EVDEV', true) + man_pages += 'tools/xkbcli-interactive-evdev.1.ronn' endif if get_option('enable-x11') x11_tools_dep = declare_dependency( @@ -563,7 +583,13 @@ if build_tools xcb_xkb_dep, ], ) - executable('xkbcommon-interactive-x11', 'tools/interactive-x11.c', dependencies: x11_tools_dep) + executable('xkbcli-interactive-x11', + 'tools/interactive-x11.c', + dependencies: x11_tools_dep, + install: true, + install_dir: dir_libexec) + man_pages += 'tools/xkbcli-interactive-x11.1.ronn' + configh_data.set10('HAVE_XKBCLI_INTERACTIVE_X11', true) endif if get_option('enable-wayland') wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false) @@ -591,17 +617,24 @@ if build_tools wayland_scanner_code_gen.process(xdg_shell_xml), wayland_scanner_client_header_gen.process(xdg_shell_xml), ] - executable('xkbcommon-interactive-wayland', + executable('xkbcli-interactive-wayland', 'tools/interactive-wayland.c', xdg_shell_sources, - dependencies: [tools_dep, wayland_client_dep]) + dependencies: [tools_dep, wayland_client_dep], + install: true, + install_dir: dir_libexec) + man_pages += 'tools/xkbcli-interactive-wayland.1.ronn' + configh_data.set10('HAVE_XKBCLI_INTERACTIVE_WAYLAND', true) endif if have_getopt_long and get_option('enable-xkbregistry') - executable('xkbcommon-registry-list', + configh_data.set10('HAVE_XKBCLI_LIST', true) + executable('xkbcli-list', 'tools/registry-list.c', dependencies: dep_libxkbregistry, - install: false) + install: true, + install_dir: dir_libexec) + man_pages += 'tools/xkbcli-list.1.ronn' endif endif diff --git a/test/xkeyboard-config-test.py.in b/test/xkeyboard-config-test.py.in index 935511f..3ea4759 100755 --- a/test/xkeyboard-config-test.py.in +++ b/test/xkeyboard-config-test.py.in @@ -41,7 +41,8 @@ def xkbcommontool(rmlvo): v = rmlvo.get('v', None) o = rmlvo.get('o', None) args = [ - 'xkbcommon-rmlvo-to-keymap', + 'xkbcli', + 'compile-keymap', '--rules', r, '--model', m, '--layout', l, diff --git a/tools/rmlvo-to-keymap.c b/tools/compile-keymap.c similarity index 100% rename from tools/rmlvo-to-keymap.c rename to tools/compile-keymap.c 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 -- 2.7.4