2

I had added up English(US), Belgian(alternative), Tamil Keyboard layouts using the GUI.

How do I easily switch between these three layouts from terminal?

Braiam
  • 67,791
  • 32
  • 179
  • 269
Avinash Raj
  • 78,556
  • 2
    Answers on the Original question doesn't works for me.I'm running 13.10.But the below answer makes to easily switch between different keyboard layouts which we are added. – Avinash Raj Jan 25 '14 at 02:01

2 Answers2

2

In Ubuntu 13.10, if your keyboard layouts are exactly in this order: English (US), Belgian (alternative), Tamil and:

  • if you have set English (US) keyboard layout, then:

    • to change to Belgian (alternative) keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'be+oss'), ('xkb', 'in+tam'), ('xkb', 'us')]"
      
    • to change to Tamil keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'in+tam'), ('xkb', 'us'), ('xkb', 'be+oss')]"
      
  • if you have set Belgian (alternative) keyboard layout, then:

    • to change to Tamil keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'be+oss'), ('xkb', 'in+tam'), ('xkb', 'us')]"
      
    • to change to English (US) keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'in+tam'), ('xkb', 'us'), ('xkb', 'be+oss')]"
      
  • if you have set Tamil keyboard layout, then:

    • to change to English (US) keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'be+oss'), ('xkb', 'in+tam'), ('xkb', 'us')]"
      
    • to change to Belgian (alternative) keyboard layout, use:

      gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'be+oss'), ('xkb', 'in+tam')]"
      

Obs: These commands works only in Ubuntu 13.10 (and maybe later versions).

Radu Rădeanu
  • 169,590
2

You can change keyboard layouts using setxkbmap. This is guaranteed to work with any version of Ubuntu. To change to us layout:

setxkbmap us

To change to tamil:

setxkbmap in+tam

to change to Belgian:

setxkbmap be+oss

The preferences will be kept until you close your session or restart the system.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • That doesn't actually seem to be the case - yes, you can change the layout, but ubuntu will reset it after a short period of time, in my experience (only 13.10 and up). – Fake51 Mar 06 '14 at 14:01
  • @Fake51 he doesn't want to do the change permanent as far I read the question. – Braiam Mar 17 '14 at 11:51
  • Presumably more than 1 minute or first window switch - that's all the persistence I get. – Fake51 Mar 17 '14 at 18:06