Kbd-query is a program that allows you to easily change the keyboard layout using setxkbmap program. It also supports additional xmodmap changes to be done after the keyboard layout is changed (i.e it allows you to map the capslock to control no matter which keyboard layout you select).

The source of the 0.3 version is available in http://www.acr.fi/kbd-query/kbd-query-0.3.tar.gz. Read the README for more information. This program is distributed BSD style license. Read the COPYING for more information about the license.