I have found an older thread in the Ubuntu forums but I guess there is a more simple solution now. I would like to switch between the default German layout and an English (US) one.

4 Answers 4


As arno says, try:

setxkbmap -option grp:alt_shift_toggle "us,il"

(for hebrew).

To make this permanent:

 echo '@setxkbmap -option grp:alt_shift_toggle "us,il"' | sudo tee -a /etc/xdg/lxsession/Lubuntu/autostart

You can use Lxkeymap under preferences. There is a Keyboard Layout Switcher under Panel Preferences / Panel Applets.

  • Lxkeymap lets me change the layout, but I would just like to add one so that I can switch from one to the other.
    – H3R3T1K
    Feb 8, 2012 at 9:13
  • You can add German using Preferences/Language Support Feb 8, 2012 at 9:40
  • How do I assign a keyboard shortcut to switch between them?
    – H3R3T1K
    Feb 8, 2012 at 10:03
  • Try right clicking the panel, Select Add/Remove Panel Items, Panel Applets, Add, Keyboard Layout Switcher. Feb 8, 2012 at 11:01
  • 1
    Already got it. No option to set keyboard shortcut though. Didn't find it anywhere else neither. What did it (the added layout plus the switching using a keyboard shortcut) was this: echo '@setxkbmap -option grp:ctrl_shift_toggle "de,us"' | sudo tee -a /etc/xdg/lxsession/Lubuntu/autostart
    – H3R3T1K
    Feb 8, 2012 at 14:22

This is a general solution including solving other possible problems when setting keyboard layouts and changing them with shortcuts. I have tested this in Lubuntu oneiric, precise, and quantal.

- First, using the GUI Keyboard Layout Handler

Right click on the Keyboard Layout Handler button from the LXPanel

enter image description here

Then "Add"

enter image description here

There are different types of layouts for the same language

enter image description here

Also set the shortcut (Change Layout Option).

  • In case the GUI might not work or is not present in 11.10 etc

    or settings are nor respected after logout, or they are not translated in practice etc. (it happened often to me in 11.10, not anymore after 12.04).

Check current xkb parameters with:

setxkbmap -query

I'll give an example with three languages, US Englush, French and Romanian standard. For German it is "de" I think.

So, to set us,fr,ro layout with variants default (us), (fr) and standard (ro) that can be changed with ALT-SHIFT keys:

setxkbmap -layout "us,fr,ro" -variant ",,std" -option "grp:alt_shift_toggle"

To test if all are OK and make all changes permanent (if gedit is the preferred text editor):

gksudo gedit /etc/default/keyboard

See that parameters are according:


See that the settings in Keyboard Layout Handler are exactly the same regarding also order, subtype and shortcut.

- Other possible issues.

In 12.10 I had a more bizarre problem. In spite of doing the above two steps only the main language was accessible. This was solved by removing and reinstalling all secondary languages (all except the main one) and adding the secondary languages as in the previous steps.


The permanent solution provided by user1112507 worked for me in Lubuntu 12.04, but not in 12.10 where setxkbmap apparently needs to delay before executing.

His solution, modifying /etc/xdg/lxsession/Lubuntu/autostart, is for all users. Here is a workaround for the single-user case:

  1. Install the desired languages.

    $ gnome-language-selector
  2. Create a shell script to execute setxkbmap after a delay and save it in a convenient place. Running it in the background may speed up the login process. Increase sleep time if needed. Replace "us, il" with your desired language codes.

    $ echo '(sleep 2; setxkbmap -option grp:alt_shift_toggle -layout "us,il") &' > ~/setxkbmap.sh
  3. Make the script executable and verify that it works by toggling the key combination Alt-Shift to switch language.

    $ chmod +x ~/setxkbmap.sh
    $ ~/setxkbmap.sh
  4. Create a .desktop file which executes the shell script just created. Replace "username" with your username.

    $ echo '[Desktop Entry]
    Name=Keyboard Language Switcher
    ' > ~/Desktop/setxkbmap.desktop
  5. Logout and login again, then test by clicking on the new icon on your desktop, then toggling Alt-Shift.

  6. Move the .desktop file to ~/.config/autostart

    $ mv ~/Desktop/setxkbmap.desktop ~/.config/autostart
  7. Logout and login again, then test by toggling Alt-Shift.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.