6 use open IO => ':encoding(utf-8)', ':std';
10 our $VERSION = '1.01';
13 open my $keysymh, '<', 'data/keysymdef.json' or die $!;
15 return JSON->new->decode(readline $keysymh);
16 } or die "Could not read keysym definitions: $@\n";
58 LSGT => ["§", "±"], # mac
74 my ($pos, $def) = m/^\h* key \h+ <(\w+)> \h+ \{ (.+?) \};/ or next;
75 my @mode = map { [split /,\h*/] } $def =~ m/\[ \h* (.*?) \h* \]/g;
76 for my $shift (0, 1) {
77 defined(my $chr = $mode[0]->[$shift + 2])
78 or warn "missing $pos +$shift\n";
79 if ($chr =~ m/^U ([A-F0-9]+) $/) {
82 elsif (defined $symname->{$chr}) {
83 $chr = $symname->{$chr};
86 warn "unknown symbol $chr at $pos\n";
88 $res{$geochar{$pos}->[$shift] // $pos} = $chr;
89 #$res{$pos}[$shift] = $symname->{$chr} // $chr; # geochar
92 say pp(\%res) =~ s/(?<=") \\x \{? ([0-9A-F]{2,6}) \}?/chr hex $1/reg;
98 mkkeyboard-xkb-symbols - Character map of an xkb symbols file
102 cat /usr/share/X11/xkb/symbols/us |
103 perl -ne 'print if /^xkb_symbols "intl"/../^\};/' |
104 mkkeyboard-xkb-symbols >map-us-intl.inc.pl
108 Parses C<key> declarations inside an C<xkb_symbols> section
109 and returns a perl hash of normalised qwerty input to unicode output
110 of 3rd and 4th levels (altgr and shift+altgr modes)
111 to be manually cleaned and integrated in a keyboard page include.
115 Mischa POSLAWSKY <perl@shiar.org>
119 Licensed under the GNU Affero General Public License version 3.