#!/bin/sh xmodmap -pke | while read line; do set -- $line sep="" shift keycode="$1" shift shift if test "$1" = ""; then continue fi printf " [ %3s ] = { " "$keycode" while test "$1" != ""; do case "$1" in NoSymbol | XF86_*) keysym="0" ;; *) keysym="XK_$1" ;; esac echo -n "${sep}${keysym}" sep=", " shift done echo " }," done