How to show current keyboard layout on mate-panel as country flag?

I'm using Ubuntu MATE 14.04 LTS, 16.04 LTS and 18.04 LTS.

I want to change current keyboard layout indication from text (for example ru, en) to the corresponding country flags.

How can I do this?


Solution 1:

On Ubuntu MATE 18.04 LTS and newer you need to send one command:

gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags true

it will change MATE Panel appearance from

ru in mate-panel

to

russian flag in mate-panel


On Ubuntu 16.04 LTS having MATE 1.12 this method does not work out-the-box (it is bug 1783543), but we have two options here:

  • download flags manually and place them in home folder:

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

    then toggle layout indicator state:

      gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags false
      gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags true
    

    and we will get flags in place. Note: I used ru and us, you can pick others from LinuxMint GitHub repository.

  • use newer MATE 1.16 from official xenial-mate PPA:

      sudo apt-add-repository ppa:ubuntu-mate-dev/xenial-mate
      sudo apt update
      sudo apt full-upgrade
    

    then enable flags

      gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags true
    

    and we can get flags in place after reboot and login.


On Ubuntu 14.04 LTS we need to download flags manually (as in 16.04 LTS):

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

then toggle layout indicator state:

gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags false
gsettings set org.mate.peripherals-keyboard-xkb.indicator show-flags true

and we will get flags in place.