Hash :
0cd1087a
Author :
Date :
2024-09-12T01:43:56
xkbcli how-to-type: Enhance arguments parsing & doc Currently the positional parameter of the CLI is either a Unicode code point or a keysym. However their respective format is not documented. It turns out that there are multiple issues due to the use of `strtol`: - Code points can be parsed as octal, decimal and hexadecimal, while keysyms can only be parsed as hexadecimal. Some programs outputs keysyms in their decimal form (e.g. `wev`) so it is worth to bring symmetry with code points. - Octal format is unusual for both and is triggered by leading zeros, which is unintuitive in this context. - `U+NNNN` format is the standard format for Unicode code points but is not supported. - Plain characters are not supported, e.g.: a, é, ß, Æ, γ, 🦆, etc. Although this is probably the easiest format for most users. Fixed the issues above: - Allow the code point to be passed exactly in the following formats: - Literal character (requires UTF-8 character encoding of the terminal); - Decimal number; - Hexadecimal number: either `0xNNNN` or `U+NNNN` (any digit count) - Allow the keysym to be passed exactly in the following formats: - Decimal number; - Hexadecimal number: `0xNNNN` (any digit count); - Name. - Improve both `--help` message and manual page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
.Dd September 11, 2024
.Dt XKBCLI\-HOW\-TO\-TYPE 1
.Os
.
.Sh NAME
.Nm "xkbcli\-how\-to\-type"
.Nd query how to type a given Unicode code point or keysym
.
.Sh SYNOPSIS
.Nm
.Op options
.Ar character/codepoint/keysym
.
.Sh DESCRIPTION
.Nm
prints the key combinations (keycode + modifiers) in the keymap's layouts which
would produce the given Unicode code point or keysym.
.
.Pp
.Ar codepoint/keysym
is either:
.
.Bl -bullet -compact
.It
a single character (requires a terminal which uses UTF-8 character encoding);
.It
a Unicode code point, interpreted as hexadecimal if prefixed with
.Li 0x
or
.Li U+
else as decimal;
.
.It
a keysym if
.Fl \-keysym
is used: either a \fInumeric\fP value (hexadecimal if prefixed with
.Li 0x
else decimal) or a keysym \fIname\fP.
.El
.
.Sh EXAMPLES
.Bl -tag -width Ds
.It Nm Fl \-layout Ar us 97
.It Nm Fl \-layout Ar us 0x61
.It Nm Fl \-layout Ar us U+0061
.It Nm Fl \-layout Ar us a
Print the key combinations that produce the letter "a"
.Po
decimal code point:
.Ar 97 ,
hexadecimal code point:
.Ar 61
.Pc
in the default
.Ar us
layout.
.It Nm Fl \-layout Ar us Fl \-keysym Ar 97
.It Nm Fl \-layout Ar us Fl \-keysym Ar 0x61
.It Nm Fl \-layout Ar us Fl \-keysym Ar a
Print the key combinations that produce the keysym "a"
.Po
decimal code:
.Ar 97 ,
hexadecimal code:
.Ar 61
.Pc
in the default
.Ar us
layout.
.Be
.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl \-keysym
Treat the argument as a keysym, not a Unicode code point
.
.It Fl \-rules Ar rules
The XKB ruleset
.
.It Fl \-model Ar model
The XKB model
.
.It Fl \-layout Ar layout
The XKB layout
.
.It Fl \-variant Ar variant
The XKB layout variant
.
.It Fl \-options Ar options
The XKB options
.
.It Fl \-help
Print a help message and exit.
.El
.
.Sh SEE ALSO
.Xr xkbcli 1 ,
.Lk https://xkbcommon.org "The libxkbcommon online documentation"