13

The keyboard layout indicator in GNOME, which appears in the panel after adding more than one layouts, shows preassigned abbreviations for layouts. Is there a way to rename this abbreviations? For example I want to change en to Eng here:

enter image description here

If I'm not mistaken it can be done pretty easily in KDE.

Distro: Ubuntu GNOME 17.04

6

1 Answer 1

11
+50

This method only works with Xorg*

(* Update from the original asker: It seems the changes made in an Xorg session persist after rebooting to a Wayland session.)


Introduction

Basically, GNOME-Shell seem to be obtaining the abbreviations of the keyboard layouts from a configuration file ( /usr/share/X11/xkb/rules/evdev.xml). So to change them, we first need to open the configuration file in a text editor and then change them to whatever we want!

There are two different ways to do it. Though the graphical interface which includes the mouse or the command line interface which is only the keyboard.


Common first step

First open a terminal.

There is many way to do this. This method is the simplistic. Press Alt + F2 on your keyboard. You will see a dialog box come up and type in gnome-terminal or the name of your terminal. It should look like this now.

Dialog1

Now, press Enter. It should close and bring up an terminal.

Blank Terminal

Form here there are two ways: First the graphical way, or the Command interface.


Graphical Method

  1. Now type in

    sudo -i gedit /usr/share/X11/xkb/rules/evdev.xml
    

    This is how it should look.

    Terminal with filename1

  2. Now, press Enter and it should open the file in which we need to edit. This is how it should look:

    Gedit_1

  3. Now click on the bottom with the three dots. Highlighted in blue, then find and click on "Find and Replace..." Highlighted in lighter gray.

    enter image description here

    Now it should bring up an dialog

    Dialog_2

  4. Now we can edit this file to change "en" to "Eng". This will change all of the layouts that uses "en"

    Now, type into the text-box with "Find" to the left of it with this <shortDescription>en</shortDescription> Next, with the textbook below it and text to the left that says "Replace with", type this in it <shortDescription>Eng</shortDescription>. Now it should look like this.

    Dialog 2

    However, if you only want to change one layout then you will need to find it individually instead of changing all of them. I would just used the Find function to search for the name of it which needs to be spell exactly to find it.

  5. Now click on the button that says "Replace all" now that dialog box should disappeared with it saying it's found and replace 9 or so occurrences.

    Gedit_2

  6. Now save it by clicking on the save button highlighted in light gray.

    Gedit_4

    Now, notice that the asterisk in the title should go away like this. If it didn't then it didn't save.

    Gedit_1

  7. Restart your PC. Now it should look like this. Notice, that I did it with "eng" instead of "Eng"

    enter image description here


Command line interface

  1. Type in

    sudo sed -i -e 's/<shortDescription>en</shortDescription>/<shortDescription>Eng</shortDescription>/g' /usr/share/X11/xkb/rules/evdev.xml
    
  2. Press Enter on your keyboard.

  3. Type in your password.

  4. Press Enter on your keyboard.

  5. Restart your PC.

12
  • 1
    First I made a change (en to Eng) by the graphical method described in the answer in an Xorg session, and it worked. Then I rebooted and started a GNOME on Wayland session and the change I made still applied there (it showed Eng instead of en)!
    – pomsky
    Sep 19, 2017 at 14:05
  • 3
    It’s really hard to see what is actually going on with all these screenshots put in between the facts. The OP has 18k points here, it may just be possible he knows how to open a shell.
    – MPi
    Jun 22, 2018 at 7:10
  • @MPi I made it for anyone. Anyone that uses Ubuntu with Gnome at the time. Even the newbies. If you don't like the graphical way then you can do it by the Command line way. I left two options for a reason.
    – MathCubes
    Jun 27, 2018 at 3:46
  • @MPi Also when he asked the question and when I answer it. He only had 5 points.
    – MathCubes
    Jun 27, 2018 at 3:48
  • @MPi Proof i.imgur.com/rr0c9tn.png
    – MathCubes
    Jun 27, 2018 at 3:51

You must log in to answer this question.

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