From c5565bd05f729e490573ccc6f34f5a8d52570a27 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 9 Sep 2020 10:09:13 +0300 Subject: 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 --- tools/how-to-type.c | 6 +++--- tools/xkbcli-how-to-type.1 | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'tools') 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 ] [--model ] " "[--layout ] [--variant ] [--options ]" " \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 -- cgit v1.2.1