Second, the switching of the keyboard didn't work because your SwitchLayout function takes a HoH as argument, while your menu-commands only supplies a single hash. It works like a charm if you would change lines 305/306 to:
$f->command(-label=>'QWERTY', -command=>[\&SwitchLayout, $a=>\%QWERTY]
$f->command(-label=>'DVORAK', -command => [\&SwitchLayout, $a=>\%DVORA
(Yes, I misabused the global $a
for this purpose ;-)
Hope it helps,
"A chicken is an egg's way of producing more eggs."