switching keyboard layouts on debian

As are perhaps many people I sometimes use a qwerty keyboard and sometimes I’m using an azerty keyboard and/or maybe you want qwerty on an azerty due to typing habits etc.
So yes you want to change the layout asap

patrick@debian:~$ cat /etc/default/locale 
#  File generated by update-locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"

so that is what you are using on your system right now. I want to switch to a belgian azerty so I make sure I have the goods

patrick@debian:~$ sudo apt-get install console-data unicode-data

Now reconfigure your locales and you will be presented with a prompt where you can check the layouts you need.

patrick@debian:~$ sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
  en_US.UTF-8... done
  nl_BE.ISO-8859-1... done
  nl_BE.UTF-8... done
  nl_BE.ISO-8859-15@euro... done
Generation complete.

Now just set it in bash..

patrick@debian:~$ setxkbmap be

System wide I still have en_US set

patrick@debian:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

You can see this here as well

patrick@debian:~$ cat /etc/default/keyboard 
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

So you could now set this command in a startup bash script. Systemwide you can do this in /etc/profile
or you can execute the command below, it will also give you the opportunity to set some other options like what your alt key does and the symbol key (commonly known as a winkey or superkey)

patrick@debian:~$ cat /etc/default/keyboard 
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="be"
XKBVARIANT=""
XKBOPTIONS="lv3:ralt_switch,compose:lwin,terminate:ctrl_alt_bksp"

BACKSPACE="guess"

Allright have fun 🙂

additional information: https://wiki.debian.org/Keyboard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s