\expandafter \ifx \csname Key\endcsname \relax
\def\Key#1#2#3{}
\fi
\def\setKeyByName#1#2#3{%
\expandafter \ifx \csname setKeyName\endcsname \relax \else \setKeyName{#1}{#2}{#3}\fi
\ex\edef\csname Key#3Row\endcsname{#1}%
\ex\edef\csname Key#3Col\endcsname{#2}%
\edef\tmp##1{\noexpand\Key{##1}{#1}{#2}}%
\letcs{Key#3}{tmp}
}
\def\setKeyByNames#1#2#3{%
\countj#2%
\for{iter}\in{#3}{%
\setKeyByName{#1}{\the\countj}{\iter}%
\advance\countj1}%
}

\setKeyByNames{0}{0}{{Esc}}
\for i 1 {13}{\setKeyByName{0}{\the\counti}{F\the\counti}}
\setKeyByNames{1}{0}{`1234567890-={Backspace}}
\setKeyByNames{2}{0}{{Tab}QWERTYUIOP[]{Entr}}
\setKeyByNames{3}{0}{{CapsLk}ASDFGHJKL;'{BackSlash}}
\setKeyByNames{4}{0}{{Shift}{Not}ZXCVBNM,./{Shift}}
\setKeyByNames{5}{0}{{Ctrl}{Super}{Alt}{Space}{AltGr}{Super}{Ctrl}}
\setKeyByNames{6}{0}{{PrtSc}{ScrLock}{Pause}}
\setKeyByNames{7}{0}{{Insert}{Home}{PgUp}}
\setKeyByNames{8}{0}{{Delete}{End}{PgDown}}
\setKeyByNames{9}{0}{{Up}}
\setKeyByNames{10}{0}{{Left}{Down}{Right}}
\setKeyByNames{11}{0}{{NumLock}/*-}
\setKeyByNames{12}{0}{{N7}{N8}{N9}+}
\setKeyByNames{13}{0}{{N4}{N5}{N6}}
\setKeyByNames{14}{0}{{N1}{N2}{N3}{Enter}}
\setKeyByNames{15}{0}{0.}

% mods
\def\allmod{{\relax}{\relax\Shift}{\Ctrl}{\Ctrl\Shift}{\Super}{\Shift\Super}{\Ctrl\Super}{\Ctrl\Shift\Super}}
