12

Just upgraded from 10.04 to 10.10, and the keyboard indicator applet no longer displays the two-letter country code for the active layout.

This is terrible. Is this the default behaviour? Anyone using two layouts can't tell which language they're in.

I can't seem to find the setting for this, it used to be in the preferences for keyboard layout.

Update 1: In case this wasn't obvious - I have two keyboard layouts - English and Hebrew. I just upgraded form 10.04, where the country code (USA/IL) was displayed, overlaid on the flag.

Now all I get is a vague keyboard icon, and can't find the settings for this.

Update 2: this seems to be a bug that people have been reporting since Lucid, and is now back in Maverick

3
  • Thanks Jono for the last post. I accidentally removed the Indicator App. Adding it solved the missing three letter indicator of layout used. Cheers, Gideon
    – user10337
    Feb 7, 2011 at 0:39
  • It seems 13.10 has updated the keyboard indicator. Solutions in this thread don't work. Any clues?
    – Hamid
    Oct 21, 2013 at 21:36
  • I haven't used Ubuntu since 2011. Does is still have a keyboard indicator issue?
    – Jono
    Nov 11, 2013 at 0:47

10 Answers 10

8

10.10

Yes, the icon doesn't reflect the language chosen. I think it may have something to do with the fact that showing "flags" would often be inappropriate. (Examples: flag of Great Britain in India, flag of Germany in Austria, flag of France in Senegal).

The current metaphor, i.e. KEYBOARD → Langauge is very much in accordance with user experience guidelines.

The behaviour you're describing was removed quite some time ago. It was another application (can't remember the name) that dealt with keyboard layouts then. (At least I remember something like that, I'm not quite sure now come to think of it)

What i did to get the above screen shot was go to Keyboard-Layouts, select add, Hebrew/Israel and add it to the list. My system has been upgraded since 9.10, so it should be the same on nearly every Ubuntu installation.


alt text

The old behaviour is still lurking in the system. If you want the indicator to show Flags, you can open gconf-editor, got to /desktop/peripherals/keyboard/indicator and enable "showFlags". However, you'll need the relevant flags to be in /home/<username>/.icons/flags (press CTRL+H to show directories that start with a period). The flag of israel should be named il.png (which is israels ISO 3166-1 alpha-2 country code).

3
  • Thanks, I'll try to remove the Hebrew layout, and add it again, see if that works.
    – Jono
    Oct 29, 2010 at 16:39
  • 1
    In any case, just to be clear -- it's not the flags I'm looking for.
    – Jono
    Oct 30, 2010 at 7:35
  • Stefano - this didn't seem to help. I wonder if this is an issue with the Netbook Edition, where it doesn't show the language name near the keyboard icon?
    – Jono
    Oct 30, 2010 at 7:39
5

12.10

By default the keyboard indicator in 12.10 shows a keyboard icon and the 2-letter abbreviation of the layout.

If you want to show the country flags instead, you have to do two things

  1. Set the configuration option for dconf:

    dconf write /org/gnome/libgnomekbd/indicator/show-flags true

  2. Install the flags icons in the ~/.icons (not ~/.icons/flags) folder. An easy way to do this is by installing famfamfam-flag-png and linking the icons to your folder by

    ln -s /usr/share/flags/countries/16x11/*.png ~/.icons/

4
+150

Ubuntu 12.04

The keyboard indicator appears when you have more than one keyboard layout defined.

screenshot

The country is displayed using the 2-letter code

for example - france:

screenshot

how-to

Search in Dash for keyboard layout

Note

Unlike in 10.10 - whilst there is a gconf entry for keyboard, there is not a similar show-flags key.


If you want the country flag to be displayed instead of the keyboard indicator, you can use a small applet called gxneur.

screenshot

gxneur

To do this, we need to whitelist gxneur. Use dconf-editor:

dconf-tools

screenshot

  • Add gxneur as shown.
  • Logout and login.
  • Start gxNeur from Dash.
  • This will display the applet.
  • Right-click the displayed applet, choose Keyboard Properties and select the Properties tab. Ensure the Auto Startup checkbox is ticked.
  • Next you need to disable the standard keyboard-indicator. Follow the instructions in this Q&A to achieve this.
0
2

Ubuntu 10.04

Well, it turns out that this is a bug that was in the Lucid Beta and is now showing up again (See here: https://bugs.launchpad.net/gnome-settings-daemon/+bug/531173).

Here's a workaround:

  1. Right-click on the notification area and select Add Applet...
  2. Add the applet called "Indicator Applet".

This should supersede (replace) the current indicator group, but might make a bit of a mess.

1

I found a python scrypt here: ubuntu App Developer: Application indicators to do an indicator App, and I tweak it a bit and did a litle Lang flag indicator.

enter image description here

country-indicator.py

#!/usr/bin/env python
# Copyright 2009 Canonical Ltd.
#
# Authors: Neil Jagdish Patel <[email protected]>
#          Jono Bacon <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it 
# under the terms of either or both of the following licenses:
#
# 1) the GNU Lesser General Public License version 3, as published by the 
# Free Software Foundation; and/or
# 2) the GNU Lesser General Public License version 2.1, as published by 
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but 
# WITHOUT ANY WARRANTY; without even the implied warranties of 
# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 
# PURPOSE.  See the applicable version of the GNU Lesser General Public 
# License for more details.
#
# You should have received a copy of both the GNU Lesser General Public 
# License version 3 and version 2.1 along with this program.  If not, see 
# <http://www.gnu.org/licenses/>
#
import gtk
import appindicator
import getpass
import locale

lang = locale.getdefaultlocale()
user = getpass.getuser()

png = '/home/' + user + '/.icons/flags/' + lang[0] + '.png'

def menuitem_response(w):
  gtk.main_quit()

if __name__ == "__main__":
  ind = appindicator.Indicator ("lang-flag-indicator", png, appindicator.CATEGORY_APPLICATION_STATUS)
  ind.set_status (appindicator.STATUS_ACTIVE)

  print "your current language is: %s, so it load the ~/.icons/flags/%s.png" % (lang[0], lang[0])

  # create a menu
  menu = gtk.Menu()
  mnuQuit = gtk.MenuItem("Exit")
  menu.append(mnuQuit)
  mnuQuit.connect("activate", menuitem_response)
  mnuQuit.show()

  ind.set_menu(menu)

  gtk.main()

it could be easily run as Python scrypt or be compiled with the pyinstaller

hope this helps

1

Ubuntu 10.10

By default, the keyboard indicator in 10.10 shows a keyboard icon and the 3-letter abbreviation of the layout.

It can also show an icon when the /desktop/gnome/peripherals/keyboard/indicator/showFlags key in GConf is set, and you have the required icons installed somewhere.

Note that, despite the GConf key name, country flags aren't the best solution here, as some keyboard layouts are not linked to one country, and some countries might have multiple totally different layouts). So the flag (file)names are not alpha-2 country codes but XKB keyboard layout codes, which in many cases are based on country codes (but don't always correctly express all the places where a certain keyboard layout is used), but in other cases are not (ara = "arabic", latam = "latin america", mao = "maori", brai = "braille", epo = "esperanto"). You can find a list of all layout codes in /usr/share/X11/xkb/rules/base.lst under the ! layout section.

As far as I know, for Natty it's planned to have SVG (or SVG-based) icons that express the keyboard layout (IIRC they will use the 3-letter abbreviation as listed in base.xml, which can be found in the same directory that I mention above) so that we don't need the keyboard icon + text any more (indicators can't be text-only currently...).

And like Richard says, it only shows when you have more than 1 layout configured.

2
  • I added a note to my question - I assumed it would be obvious that I use multiple layouts, otherwise I wouldn't need to know which layout I'm using.
    – Jono
    Oct 29, 2010 at 14:55
  • Well, I assumed you did have multiple layouts, just added that to be complete. But if I understand correctly, you see only the keyboard icon, but not the 3-letter layout abbreviation? (See stefano's first screenshot how it should look.)
    – JanC
    Oct 29, 2010 at 23:34
1

Ubuntu 10.10

It only displays if you have more than one keyboard layout configured.

Go into System > Preferences > Keyboard

On the Layouts tab, add another keyboard layout and then notice how the icon appears in the notification area.

In other words, you do not get the applet if you have only one keyboard layout to choose from.

1
  • but the icon doesn't reflect which layout I'm using - that's my problem.
    – Jono
    Oct 29, 2010 at 14:55
0

Universal solution for Ubuntu 14.04 LTS, 16.04 LTS, 18.04 LTS using Unity and GNOME FlashBack (with gnome-panel). Also it works on LightDM login screen.
But it will not work on Ubuntu 18.04 LTS with GNOME Shell because of different keyboard layout indication mechanism.

Steps to show flags for keyboard layouts:

  1. First of all we need to download country flags. In example below we use Russia (ru) and United States (us):

    cd ~/Downloads
    wget https://raw.githubusercontent.com/linuxmint/flags/master/usr/share/iso-flag-png/{ru,us}.png
    

    Note: I used ru and us, you can pick others from LinuxMint GitHub repository.

  2. Then we need to convert this PNG-flags to SVG saving alpha-channel with ImageMagick:

    sudo apt-get install imagemagick
    
    convert -alpha activate -resize x22 ru.png png:- > indicator-keyboard-Ru.svg
    convert -alpha activate -resize x22 us.png png:- > indicator-keyboard-En.svg
    
    sudo cp indicator-keyboard-*.svg /usr/share/icons/ubuntu-mono-dark/status/22/
    sudo cp indicator-keyboard-*.svg /usr/share/icons/ubuntu-mono-light/status/22/
    sudo cp indicator-keyboard-*.svg /usr/share/icons/Radiant-MATE/status/22/
    sudo cp indicator-keyboard-*.svg /usr/share/icons/Ambiant-MATE/status/22/
    

If you want to revert the changes - reinstall the following packages.

  • On 14.04 LTS:

    sudo apt-get install --reinstall ubuntu-mono
    
  • On 16.04 LTS and 18.04 LTS

    sudo apt-get install --reinstall ubuntu-mono ubuntu-mate-icon-themes
    

Note: For Ubuntu MATE (including 18.04 LTS) see other answer. It does not use indicator-keyboard, so it is other story.

0

Ubuntu 13.10

The keyboard language is indicated by two letters on a gray background (Example: En for English, Fr for French, etc). You can edit those images, which are SVG files, bearing in mind that SVG images are no more than XML files. You can do this in a text editor, but first you need to get the image(s) of the flag(s) into SVG file(s). For that you need to use Inkscape.

  1. Open your flag image (PNG, JPG, whatever) in Inkscape, and save it as an SVG file. Warning -- your flag image should not be too large, byte-wise, no more than a few hundred Kb or less.

  2. MAKE A BACKUP of the image you're going to edit. The images (the ones showing a two-letter code on a gray background) are found in:

/usr/share/icons/ubuntu-mono-dark/status/22/ AND /usr/share/icons/ubuntu-mono-light/status/22/

They are named: indicator-keyboard-En.svg for English indicator-keyboard-Fr.svg for French indicator-keyboard-Es.svg for Spanish ... you get the idea.

  1. AFTER you've backed up the ones you want to modify, open the svg image in that directory in a text editor, with root privileges, because you're going to edit it. In the same text editor, open the flag svg image you've converted in Inkscape.

  2. Generally, the final svg image should have all the properly formatted tags of an xml file, but you can remove almost anything between the tags, and replace it with the data from the

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <svg width="30" xmlns="http://www.w3.org/2000/svg" version="1.1" height="18">
        <image
            width="30"
            height="18"
            xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAArCA
            YAAADIWo5HAAAABHNCSVQICAgIfAhkiAAAAKdJREFUaIHt0LEJwmAYBuHvD1joEhYZxD
            qdC7iA+ziDG2SBFBkoYGGKuMQPD8J7AxzHtRpfR/Xks9f8vtd0
            u3bVfpe1tsez2uXc1Tt0tf0hGaADNBmgAzQZoAM0GaADNBmgAzQZoAM0GaADNBmgAzQZ
            oAM0GaADNBmgAzQZoAM0GaADNBmgAzQZoAM0GaADNBmgAzQZoAM0GaADNBlQR9MNlKHq
            pBsoPwoXC6lf4YbfAAAAAElFTkSuQmCC"
            id="image3028"
            x="0"
            y="0"
        />
    </svg>
    

    Everything between image tag and its closing "/>" came from the flag-image svg file produced by Inkscape, including that long alphanumeric string that is the "meat" of the image. Everything above and below that is from the original svg file.

In the example above I gave the image a width of 30 pixels and height of 18 pixels, it matches nicely with the other icons/indicators on the panel.

More details at: http://ubuntuforums.org/showthread.php?t=2193789

1
  • Now the problem is I have set the icons to Oxygen (using Unity Tweak Tool) and it seems it is using a generic language indicator icon that is not included in the corresponding directory (as in /usr/share/icons/ubuntu-mono-dark/status/22/). Any clues where is it fetching the generic one?
    – Hamid
    Nov 11, 2014 at 22:03
0

Ubuntu 14.04

In this case is more like user53768 answer. All you need to do is:

  1. To convert your desired images into *.svg type using Inskscape.

  2. Backup your old icons under directories /usr/share/icons/ubuntu-mono-dark/status/22/ and /usr/share/icons/ubuntu-mono-light/status/22/(in my example i use English and Greek language).

    cd usr/share/icons/ubuntu-mono-dark/status/22/
    sudo mv indicator-keyboard-En.svg indicator-keyboard-En.svg.bak    
    sudo mv indicator-keyboard-Gr.svg indicator-keyboard-Gr.svg.bak
    cd /usr/share/icons/ubuntu-mono-light/status/22/
    sudo mv indicator-keyboard-En.svg indicator-keyboard-En.svg.bak
    sudo mv indicator-keyboard-Gr.svg indicator-keyboard-Gr.svg.bak
    
  3. Make symbolic links of your images.

    sudo ln -s /home/myUser/.icons/us.svg /usr/share/icons/ubuntu-mono-dark/status/22/indicator-keyboard-En.svg
    sudo ln -s /home/myUser/.icons/gr.svg /usr/share/icons/ubuntu-mono-dark/status/22/indicator-keyboard-Gr.svg
    sudo ln -s /home/myUser/.icons/us.svg /usr/share/icons/ubuntu-mono-light/status/22/indicator-keyboard-En.svg
    sudo ln -s /home/myUser/.icons/gr.svg /usr/share/icons/ubuntu-mono-light/status/22/indicator-keyboard-Gr.svg
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .