#!/usr/bin/env perl use 5.014; use warnings; use utf8; use re '/mnsx'; use JSON; our $VERSION = '1.01'; my (%keysym, %keyval); while (readline) { m{ \A [#]define[ ]XK_ (?[a-zA-Z_0-9]+) \h+ 0x(?[0-9a-fA-F]+) ( \h* [/][*] [\h(] U[+] (?[0-9A-F]{4,6}) )? } or next; my $cp = $+{unicode} // $keyval{ $+{value} } or next; $keysym{ $+{name} } = chr hex $cp; $keyval{ $+{value} } = $cp; } print JSON->new->ascii->canonical->indent->encode(\%keysym); __END__ =head1 NAME mkxkeysymdef - Map Xorg key symbol names to Unicode characters =head1 SYNOPSIS mkxkeysymdef /usr/incnlude/X11/keysymdef.h >keysymdef.json =head1 AUTHOR Mischa POSLAWSKY =head1 LICENSE Licensed under the GNU Affero General Public License version 3.