5 use open IO => ':encoding(utf-8)', ':std';
7 use JSON 'decode_json';
10 our $VERSION = '1.01';
13 open my $keysymh, '<', 'data/keysymdef.json' or die $!;
15 return decode_json(readline $keysymh);
16 } or die "Could not read keysym definitions: $@\n";
18 say "# automatically generated by $0";
21 while ($_ = readline) {
22 my ($mnem, $chr, $trail) = m/\A <Multi_key> \h (.*?) \h+ : \h "([^"]+)" \h* (.*)/
25 $mnem !~ m/<dead | <KP_ | <U[0-9A-Fa-f]{4}/ or next; # skip non-standard keys
27 $mnem =~ s{<([^>]+)> \h?}{$symname->{$1} // die "reference to unknown keysym $1\n"}eg;
30 $mnem !~ m/[^\x20-\x7F]/ or next; # skip unicode
31 # (state $seen = {})->{$chr}++ and next;
32 printf "%s => %s,\n", pp($mnem), pp($chr);
41 mkdigraphs-xorg - Output Xorg compose sequences
46 mkdigraphs-xorg /usr/share/X11/locale/en_US.UTF-8/Compose >digraphs-xorg.inc.pl
47 perl -e'$di = do "digraphs-xorg.inc.pl"; print chr $di->{AT}'
51 Extracts Multi_key definitions from X11/Xorg Compose.pre include file.
52 If successful, Perl code is output resulting in a hash
53 with Unicode code points keyed by mnemonics.
54 Any errors and warnings are given at STDERR.
58 Mischa POSLAWSKY <perl@shiar.org>
62 Licensed under the GNU Affero General Public License version 3.