In Debian systems the default keyboard layout is described in /etc/default/keyboard and it is shared between X and the console. –man
Default keyboad is listed in /etc/default/keyboard:
# KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="pc105" XKBLAYOUT="gb" XKBVARIANT="danmak" XKBOPTIONS="ctrl:swapcaps" BACKSPACE="guess"
X keyboards are configured in /usr/share/X11/xkb/, in the rules and symbols directories.
/usr/share/X11/xkb/symbols/gb can be linked to ~/config/gb. Likewise in rules, base.xml and evdev.xml. See Keymap for a quick setup script.
This has to be swapped on a per-desktop environment basis. KDE has various native options, Gnome requires a download of gnome-tweak-tool via apt-getgnome-tweaks via apt (keyboard and mouse → additional layout options → ctrl position (not caps lock behaviour) → swap ctrl and caps lock).