xkblayout-state (get/set the keyboard layout)
A small command-line program to get/set the current keyboard layout.
It's a thin wrapper around a slightly modified version of the
XKeyboard class, by Jay Bromley.