keyboard

System-Wide Capslock and Escape Swap

This works everywhere, including in a bare-ass tty.

Select a keymap, and create a new custom map.

1su root
2
3basemap=/usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz
4newmap=/usr/share/kbd/keymaps/custom.map.gz
5
6gunzip -c $basemap | \
7    sed 's/Caps_Lock/\n/g;s/Escape/Caps_Lock/g;s/\n/Escape/g' | \
8    gzip > $newmap

Tell the system to use this keymap at startup by naming it in the rc.conf file:

1echo "KEYMAP=$newmap" >> /etc/rc.conf
2
3cat /etc/rc.conf
4reboot

Set Layout with X Display

Set layout to British English.

1setxkbmap -layout gb

Or Polish with:

1setxkbmap -layout pl
Language short
Polish pl
Serbian rs

Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.

1setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle

Alt_GR

Remap, e.g., the right Windows key, to Alt_Gr.

1    key <RWIN> {[  ISO_Level3_Shift    ]};