#!/usr/bin/env perl use 5.014; use warnings; use utf8; use re '/msx'; use JSON; our $VERSION = '1.00'; my %keysym; 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; $keysym{ $+{name} } = chr hex $+{unicode}; } 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.