How to change keyboard language in linux
How to change keyboard language in linux
Ubuntu Documentation
Keyboards come in hundreds of different layouts for different languages. Even for a single language, there are often multiple keyboard layouts, such as the Dvorak layout for English. You can make your keyboard behave like a keyboard with a different layout, regardless of the letters and symbols printed on the keys. This is useful if you often switch between multiple languages.
Click Keyboard in the sidebar to open the panel.
If there are multiple user accounts on your system, there is a separate instance of the Region & Language panel for the login screen. Click the Login Screen button at the top right to toggle between the two instances.
Some rarely used keyboard layout variants are not available by default when you click the + button. To make also those input sources available you can open a terminal window by pressing Ctrl + Alt + T and run this command:
gsettings set org.gnome.desktop.input-sources show-all-sources true
You can preview an image of any layout by selecting it in the list of Input Sources and clicking
Certain languages offer some extra configuration options. You can identify those languages because they have a icon next to them. If you want to access these extra parameters, select the language from the Input Source list and a new
button will give you access to the extra settings.
When you use multiple layouts, you can choose to have all windows use the same layout or to set a different layout for each window. Using a different layout for each window is useful, for example, if you’re writing an article in another language in a word processor window. Your keyboard selection will be remembered for each window as you switch between windows. Press the Options button to select how you want to manage multiple layouts.
The top bar will display a short identifier for the current layout, such as en for the standard English layout. Click the layout indicator and select the layout you want to use from the menu. If the selected language has any extra settings, they will be shown below the list of available layouts. This gives you a quick overview of your settings. You can also open an image with the current keyboard layout for reference.
Switch between languages in Linux with xkb. Write in multiple languages with same keyboard.
How to set up multiple keyboard layouts from console.
Overview
A guide for Linux polyglots to use Cyrillic letters, Chinese characters, Latin letters and any other language in Linux, with the ability to easily switch between them in an X11 graphical environment or console.
The X11/Xorg server uses XKB, the X Keyboard Extension, to control the available keyboard layouts.
If we want to use many languages with the same keyboard, we will have to address four main topics: model, layout, variant and options.
To specify the different languages, we use the command setxkbmap which sets the keyboard using the X Keyboard Extension.
It is used like: setxkbmap [-model xkb_model] [-layout xkb_layout] [-variant xkb_variant] [-option xkb_options] so the in each topic we will see how to fulfill each parameter.
1. Current configuration
At this stage we pay particular attention to the current “physical” keyboard model.
XkbModel selects the keyboard model. This has an influence only for some extra keys your keyboard might have. The safe fallback are pc104 or pc105. But for instance laptops usually have some extra keys, and sometimes you can make them work by simply setting a proper model.
2. Languages
Select which keyboard layouts are needed, i.e.: the languages you will use.
XkbLayout selects the keyboard layout. Multiple layouts may be specified in a comma-separated list, e.g. if you want to quickly switch between layouts.
The layout name is often the typical two letter country code. e.g.: for Russian: ru.
3. Variants
For each layout, a variant can be chosen.
XkbVariant selects a specific layout variant. For instance, the default sk variant is qwertz, but you can manually specify qwerty, etc.
For example you can choose:
For a Russian layout, a phonetic variant is available, which will make it writing Russian in a Latin/US keyboard very intuitive.
4. Switch between layouts
XkbOptions contains some extra options (comma-separated). Used for specifying layout switching, notification LED, compose mode etc.
5. Testing
To test it works as desired, we specify the command and try to switch between layouts.
Then we press both CTRL and start typing in Р СѓСЃСЃРєРёР№.
6. Persisting Changes
setxkbmap changes the layout for the current X session only.
To keep changes in the next reboot we can choose between:
6.1 Manual
Create the X11 configuration file /etc/X11/xorg.conf.d/00-keyboard.conf with the new data:
6.2 Automatic
Following the above example:
7. Graphical indicator
Finally we add an X11 keyboard indicator and switcher.
gxkb is an utility that switchs the language selecting it from a menu, and shows an icon with the current active layout.
If you change the layout with the above combination key, gxkb also updates and show the current layout.
Keyboards layout references
Each symbol can be accesed with:
altgr stands for Alt Graph and is the right alt key. “Is a modifier key used to type characters that are unusual for the locale of the keyboard layout”. 2
Example key layout and how to access each symbol:
SHIFT | SHIFT + ALT gr |
without modifiers | ALT gr |
Arab keyboard layout without variants.
Brazilian
Brazilian portuguese keyboard layout.
English (US)
English US keyboard layout.
French
French keyboard layout.
Italian
Italian keyboard layout.
Russian
Russian phonetic
Russian phonetic variant layout lets you use a common US English layout (qwerty) but typing each letter phonetic equivalent in Cyrillic.
18.04 ctrl+shift to change language
Can I use Ctrl + Shift for changing languages? I can’t set this hotkey for changing keyboard languages.
At this moment Alt + Shift switch languages, but I can’t see this hotkey in keyboard hotkeys list or in
2 Answers 2
You can set such keyboard shortcut as follows:
On Ubuntu 18.04 LTS, 20.04 LTS, 21.04 and 21.10 with GNOME desktop from GNOME Tweaks.
Then open GNOME Tweaks ( gnome-tweaks ).
Select Keyboard & Mouse tab
Click Additional Layout Options button
Expand Switching to another layout
Select Ctrl + Shift here
See screenshot below:
If you do not like Super + Space and Shift + Super + Space you can disable them with
Note: you will face interference problem as Ctrl + Shift + T in GNOME Terminal will switch language at once with opening new tab. It is known bug 1683383.
On Ubuntu MATE 18.04 LTS and newer versions this is possible from mate-keyboard-properties :
See screenshot below:
Note: here bug 1683383 is fixed by packages from my PPA :
So Ctrl + Shift keyboard layout switcher will work normally on MATE DE after applying patch from ArchLinux AUR «for freedesktop bug 865 (need to kick hotkeys on release, not press)».
Warranty disclaimer: packages were tested in
However other desktops may have issues even after applying the patch.
These packages do not fix problems for GNOME Shell (18.04 LTS, 18.10, 19.04, 19.10, 20.04 LTS, 20.10 and 21.04) and Unity (in 18.04 LTS and 18.10).
How do I switch between keyboard layouts?
I want to switch between English and another language.
I have tried Lubuntu and it was easy, I figured it out from the friendly menus. But in Ubuntu everything is so cryptic.
5 Answers 5
Its as easy to do as in Lubuntu. Click on System Settings, and click on Keyboard Layout:
Click on the «+» sign to add a layout
Search for the language you want, in this example Greek, and add it
Look at the keyboard layout icon, and you will see the new language. Just click it to choose it.
Ubuntu 12.04
In this example I am using Greek as the new keyboard layout language, but you can substitute any other keyboard layout language in the list for Greek in order to add a different keyboard layout language. Select Greek (polytonic) from the menu and click the Add button to add the Greek Polytonic language to the language selection menu that is in the notification area of the desktop panel next to the volume icon and the clock icon.
Ubuntu 14.04 and later releases
The instructions are the same as for Ubuntu 12.04 (and also for Ubuntu 12.10 and Ubuntu 13.04), except for the first paragraph:
Make sure that «Show current input source in the menu bar» is marked by a check mark.
Geia soy Georgios. You don’t mention the version of Ubuntu you are using, so I will describe how to add polytonic Greek on Ubuntu 12.04.2 LTS which I’m currently using.
Select the System Settings icon from the dash. Alternatively click dash-home and type ‘System settings’, then click on the icon presented to you.
On the window that has appeared, in the hardware section, you will notice a keyboard icon. Click on that. The content changes and at the bottom you will notice a link «Layout Settings». Click on that. Again the contents of the window change.
On the bottom left you will notice a «+» sign. Click on that and you will be presented a selection dialog. Type Greek in the search field to narrow down the presented options. Now select «Greek (polytonic)» and click Add. You are done.
If you want you can manage some options and behavior of the new layout by clicking on it and then clicking Options. When done, close the window. You don’t need to reboot or re-login for the changes to take affect. Ελπίζω να βοήθησα. ( If this is Greek to you, I just wrote that I hope this was helpful 🙂 )
How do I change keyboards from the command line?
How I change keyboard layouts from the command-line? For example, I want to switch from English to Hebrew. I’m able to do it from lightdm with the little icon in the corner of my screen.
9 Answers 9
You can find all the different keymaps in the following locations:
To change the keyboard layout (e.g. to Spanish) in the Linux command line, type the following command:
To make these changes system wide, assuming you’re using Ubuntu, you can use the following:
English to Hebrew and vise versa with Alt + Shift
You can see all locale alias with this command
More info about setxkbmap in manual
Ubuntu 13.10 or Later
This works better then setxkbmap with Gnome/Unity keyboard layout indicator.
0 is the layout index (0 default or top layout). Layouts indexed starting from 0.
For easy use, create an alias.
There seems to be no standard CLI tool, but xkb-switch is a small open-source tool to do the job. Just tested it with Ubuntu 16.04.4 LTS and it works flawelessly.
Caveat
/.config/kxkbrc uses LayoutLoopCount (e.g. it is set to less than the total number of layouts listed in LayoutList ), like this:
then xkb-switch would only let you switch between the layouts in current group.
Invoke at screen lock
I noticed your comment:
Right before my screensaver turns on, I want to switch to English so that it will be easy to type my password when I get back in.
This was precisely my goal, so here’s the answer:
To do that, you only need wrap it into a script hooking to dbus-monitor like discussed here.
Using gsettings in 18.04+ with Gnome, you can both add keyboard layouts and switch between them from the command line or from the keyboard layout switcher on the desktop.
Present keyboard layouts and options:
Adding keyboard layouts:
Changing the current keyboard layout from the command line:
As we now have 3 different languages, we have three choices from 0 to 2, with 1 being Spanish, 2 being Norwegian and 3 being Greek. Thus, setting current to 1 above makes Norwegian the current keyboard layout.
Listing all possible keyboard layouts:
Changing the keyboard layout with a keyboard shortcut:
A keyboard shortcut is preconfigured for changing the keyboard layout. The present shortcut:
For Ubuntu 18.04 + Gnome the other answers did not work for me, but this did:
The argument in «inputSources[0]» is the index of the keyboard layout, the same as for gsettings solution.
Disclaimer: Tested on OpenSuse Leap 15.3 xfce4 and xkb-switch is compiled from source
To make this work you should make script files with those commands and assign keyboard shortcuts to run them. Also you might want to disable Alt+Shift shortcut in keyboard switch settings to remove unexpected behavior.
So, here are my set of commands:
Also assign the following script to run on system autostart.