6

I read this article where is a workaround to add maximum eight keyboard layouts.

But my questions are:

  • I would like to try this, but I see they've written there something with "gnome" in the script. In my Ubuntu, 13.04, I have Unity. What do I do?

  • I would have to do this for four x four keyboard layouts (to have 13 keyboard layouts). This script, however, is designed for two x four keyboard layouts. How do I get the four x four?

I would really appreciate your tips and hints on this. And I would kindly ask you to keep it simple, if possible, because I'm really no expert in both Ubuntu and computers in general.

2 Answers2

2
  • In Ubuntu 13.04 forget about gconftool-2 --get /desktop/gnome/peripherals/keyboard/kbd/layouts and use only this command:

    gsettings get org.gnome.libgnomekbd.keyboard layouts

  • I updated the keyboard-layout-switch script for 4x4 keyboard layouts as follow:

#!/bin/bash

default_layout="['ro', 'gr', 'us\taltgr-intl', 'al']"    
layout_two="['ba', 'de\tdeadgraveacute', 'ph', 'gb']"    
layout_three="['de\tdeadgraveacute', 'al', 'ara', 'be']"    
layout_four="['gb', 'be', 'ro', 'ara']"

current_layout=$(gsettings get org.gnome.libgnomekbd.keyboard layouts)

case $current_layout in
"$default_layout")
    new_layout="$layout_two"
    ;;
"$layout_two")
    new_layout="$layout_three"
    ;;
"$layout_three")
    new_layout="$layout_four"
    ;;
*)
    new_layout="$default_layout"
    ;;
esac

gsettings set org.gnome.libgnomekbd.keyboard layouts "$new_layout"

exit 0

Generally, for nx4 keyboard layouts:

#!/bin/bash

default_layout="['...', '...', '...', '...']"    
layout_two="['...', '...', '...', '...']"    
layout_three="['...', '...', '...', '...']" 
.
.
.   
layout_n="['...', '...', '...', '...']" 

current_layout=$(gsettings get org.gnome.libgnomekbd.keyboard layouts)

case $current_layout in
"$default_layout")
    new_layout="$layout_two"
    ;;
"$layout_two")
    new_layout="$layout_three"
    ;;
.
.
.
"$layout_n-1")
    new_layout="$layout_n"
    ;;
*)
    new_layout="$default_layout"
    ;;
esac

gsettings set org.gnome.libgnomekbd.keyboard layouts "$new_layout"

exit 0

In rest all things remains valid as in this answer.

Just an observation: look out that the Ctrl+L shortcut will not work with some keyboard layouts (like Arabic keyboard layout for example). So, you must pay attention when you choose the keyboard layouts and the shortcut.

Wish you success when typing!

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
0

It is true that you can only have 4 keyboard layouts installed by default. This limitation does not come from Ubuntu, but from Xorg.

While a scripted approach to make multiple sets of 4 keyboard layouts available should work, IMHO it is cumbersome to use and vulnerable to breakage in the future.

You can, however, have as many input methods as you need, assuming the input method exists for the language you need. One other point is not to confuse language support in general with the keyboard layout.

My recommendation is to use the input editor ibus for as many languages as possible; and then to use a keyboard layout that works well with the other languages.

Ibus

Ibus is the standard input method for Ubuntu. To enable it, use Language Support in System Settings.

Language Support options: input method

For the fullest range of input methods, you also need to install ibus-m17n Install ibus-m17n

Set Ibus Preferences and Input Methods

After logging out and back in, you will see the ibus indicator (a little keyboard, similar to the keyboard layouts indicator. Use the drop-down menu to open the Preferences dialog. You can also start the preferences dialog from the command line with ibus-setup.

As an aside, on the General tab, it's a good idea to change Show language panel to When active or Always. There is a bug or conflict somewhere that keeps the default option of Embedded in Menu from working. The language panel provides additional functionality for the various input methods.

enter image description here

Then choose the Input Method tab. Choose Customize active input methods. Please note that installing the ibus-m17n package or language support for a language does not automatically set up an input method. You still need to do this separately.

enter image description here

Use the Select an input method button to access the sub-menus for a long list of languages.

enter image description here

After choosing the one you want, the text will change to that input method. Click Add and the Close.

enter image description here

Keyboard layouts for the remaining languages

Most languages that use the Roman alphabet with diacritics do not necessarily need a specific keyboard layout. If after setting up input methods, you only have 3 or 4 left, by all means use the specific keyboard layouts.

But in most cases, you can insert whatever characters with diacritics you need by using the English international keyboard with dead keys or by enabling the compose key in Keyboard layout options.

How you input the characters is completely separate from how programs such as LibreOffice provide language support and spell checking.

chaskes
  • 15,536