diff options
author | Ran Benita <ran@unusedvar.com> | 2020-09-09 10:09:13 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-09-09 10:11:54 +0300 |
commit | c5565bd05f729e490573ccc6f34f5a8d52570a27 (patch) | |
tree | 4963abb7d34c5869ca4d346dbc8d518e1cecb9b8 /tools | |
parent | 6178924f28fb28ca6ea131540bb67dc378c75cbd (diff) | |
download | xorg-lib-libxkbcommon-c5565bd05f729e490573ccc6f34f5a8d52570a27.tar.gz |
tools: align `xkbcli how-to-type` output ourselves
Can possibly add a machine-parsable format if desired, but for now just
have it work nicely.
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/how-to-type.c | 6 | ||||
-rw-r--r-- | tools/xkbcli-how-to-type.1 | 7 |
2 files changed, 5 insertions, 8 deletions
diff --git a/tools/how-to-type.c b/tools/how-to-type.c index 903a3ed..0a6f79e 100644 --- a/tools/how-to-type.c +++ b/tools/how-to-type.c @@ -38,7 +38,6 @@ usage(const char *argv0, FILE *fp) fprintf(fp, "Usage: %s [--rules <rules>] [--model <model>] " "[--layout <layout>] [--variant <variant>] [--options <options>]" " <unicode codepoint>\n", argv0); - fprintf(fp, "Pipe into `column -ts $'\\t'` for nicely aligned output.\n"); } int @@ -155,7 +154,8 @@ main(int argc, char *argv[]) } printf("keysym: %s (%#x)\n", name, keysym); - printf("KEYCODE\tKEY NAME\tLAYOUT#\tLAYOUT NAME\tLEVEL#\tMODIFIERS\n"); + printf("%-8s %-9s %-8s %-20s %-7s %-s\n", + "KEYCODE", "KEY NAME", "LAYOUT", "LAYOUT NAME", "LEVEL#", "MODIFIERS"); min_keycode = xkb_keymap_min_keycode(keymap); max_keycode = xkb_keymap_max_keycode(keymap); @@ -202,7 +202,7 @@ main(int argc, char *argv[]) for (size_t i = 0; i < num_masks; i++) { xkb_mod_mask_t mask = masks[i]; - printf("%u\t%s\t%u\t%s\t%u\t[ ", + printf("%-8u %-9s %-8u %-20s %-7u [ ", keycode, key_name, layout + 1, layout_name, level + 1); for (xkb_mod_index_t mod = 0; mod < num_mods; mod++) { if ((mask & (1 << mod)) == 0) { diff --git a/tools/xkbcli-how-to-type.1 b/tools/xkbcli-how-to-type.1 index a697e20..5211d0f 100644 --- a/tools/xkbcli-how-to-type.1 +++ b/tools/xkbcli-how-to-type.1 @@ -13,11 +13,8 @@ . .Sh DESCRIPTION .Nm -prints key sequences to type the given Unicode codepoint. -.Pp -Pipe into -.Dq "column \-ts $\'\e\et\'" -for nicely aligned output. +prints the key combinations (keycode + modifiers) in the keymap's layouts which +would produce the given Unicode codepoint. . .Bl -tag -width Ds .It Fl \-rules Ar rules |