anagor_lv
September 1st, 2010, 12:26 AM
This post is a little bit long. In this post I am explaining how I solved my problem.
The problem is, some compose key sequences in Ubuntu do not work correctly. For instance, <Compose key + minus + latin capital A or latin capital O> result in A and O with tildes ("Ã", "Õ"), where the majority of users would expect macrons. ("Ā", "Ō")
The issue has been filed as a bug report and is being worked on. Here is a link to the bug report:
https://bugs.launchpad.net/ubuntu/+source/libx11/+bug/408651
This post is for those who do not wish to wait until a fix is released and prefer to make a quick fix for personal use. It requires you to define your own compose key sequences. Below I am explaining how I did it.
If you would like to learn how to activate and use a Compose key, refer to my earlier thread:
http://ubuntuforums.org/showthread.php?t=1380581
Here is my solution:
First, set up the appropriate input method.
Open the terminal and run the command:
im-switch -cYou will get something like this:
anatoly@NLANGo:~$ im-switch -c
There are 8 candidates which provide IM for /home/anatoly/.xinput.d/ru_RU:
Selection Alternative
-----------------------------------------------
1 default
2 default-xim
3 ibus
4 none
5 scim
* 6 scim-bridge
7 scim-immodule
8 th-xim
System wide default for ru_RU (or all_ALL) locale is marked with [+].
Press enter to keep the current selection
, or type selection number: 2Your selected input method should be default-xim. If the selection is different, change it!
Now log out and log in again
After this is done, try out the compose key sequences you need to use (or example, <Compose> <comma> <k>). Do they work properly? Maybe, some compose characters won't work. For example, when you press <Compose> <minus> <a>, the result is no symbol (while you would expect "ā").
If any of the sequences you need work incorrectly, you are going to adjust them. This is how to do it:
In the Ubuntu system, compose key sequences are stored in the file /usr/share/X11/locale/en_US.UTF-8/Compose
In this file, each compose sequence is defined in one line, which looks something like this:
<Multi_key> <macron> <A> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON(According to the syntax of this file, <Multi_key> means the compose key)
I do not know what is the <macron> key on the keyboard. It is not the hyphen (-), the hyphen is denoted as <minus>. Preferably, to enter characters with macrons, (ā, ō, ū, ī, ē) I want to press the Compose key, the hyphen (dash), and the letter. So, the desired sequence would read <Multi_key> <minus> <a>
Therefore, I decided to replace <macron> with <minus> for all the sequences in the file.
But be careful about editing the file /usr/share/X11/locale/en_US.UTF-8/Compose with sudo!
It is not careful to edit the file /usr/share/X11/locale/en_US.UTF-8/Compose, because it is better to copy it to your home folder, and edit your local version. Copy the file /usr/share/X11/locale/en_US.UTF-8/Compose to .XCompose file in your home folder, by running this command:
cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose When you have .XCompose in your home folder, the system will use it instead of /usr/share/X11/locale/en_US.UTF-8/Compose
You can edit ~/.XCompose file without sudo privileges or administrative rights. Moreover, if you accidentally mess up the .XCompose file(it may happen), you will still have the original file, /usr/share/X11/locale/en_US.UTF-8/Compose, intact. So you can delete your old ~/.XCompose and start again.
If there are several users on your computer, you should then create ~/.XCompose file for each user individually.
So, the next steps are:
1) To copy the file /usr/share/X11/locale/en_US.UTF-8/Compose into ~/.XCompose
2) To open .XCompose with a text editor and replace all instances of <macron> with <minus> (do it automatically)
3) I recommend putting comments inside the file to make it readable for you later. Comments are preceded with # and a space.
For example:
# Anatoly replaced all instances of <macron> with <minus>
The changes will not work until you end your session and log in again, but let us do that later. There is one more thing to do.
The following step will make the system easier to use by adding extra intuitive key combinations that are not present in the original file.
The original file now lets you entrer Ā by pressing <Compose> <minus> <A> or, alternatively, <Compose> <underscore> <A>.
However, I think it would be better to add some extra combinations: <Compose> <A> <minus> and <Compose> <A> <underscore>. After doing this, you will be able to input Ā by pressing a hyphen either before, or after pressing A.
So, you add the following lines to ~/.XCompose:
<Multi_key> <A> <minus> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON - added by Anatoly
<Multi_key> <A> <underscore> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON - added by AnatolyPut your name instead of Anatoly.
Below I give some more examples. Those are the characters I use most (Latvian language). You may want to add your own combinations for your own language. Feel free to search inside ~/.XCompose for the letters you need, and think of any sequences you would find easy to use.
Č:
Original combination:
<Compose> <c> <C>
My combination:
<Compose> <C> <C>
Attention! The combination <Compose> <C> <C> will not work because it conflicts with <Compose> <C> <C> <C> <P>
To make it work, disable the latter combination or change it to a different one.
Ē:
Original combinations:
<Compose> <minus> <E>
<Compose> <underscore> <E>
My combinations:
<Compose> <E> <minus>
<Compose> <E> <underscore>
Ģ
Original combinations:
<Compose> <comma> <G>
<Compose> <cedilla> <G>
My combination:
<Compose> <G> <comma>
Ī:
Original combinations:
<Compose> <minus> <I>
<Compose> <underscore> <I>
My combinations:
<Compose> <I> <minus>
<Compose> <I> <underscore>
Ķ
Original combinations:
<Compose> <comma> <K>
<Compose> <cedilla> <K>
My combination:
<Compose> <K> <comma>
Ļ
Original combinations:
<Compose> <comma> <L>
<Compose> <cedilla> <L>
My combination:
<Compose> <L> <comma>
Ņ
Original combinations:
<Compose> <comma> <N>
<Compose> <cedilla> <N>
My combination:
<Compose> <N> <comma>
Š:
Original combination:
<Compose> <c> <S>
My combination:
<Compose> <C> <S>
Ū:
Original combinations:
<Compose> <minus> <U>
<Compose> <underscore> <U>
My combinations:
<Compose> <U> <minus>
<Compose> <U> <underscore>
Ž:
Original combination:
<Compose> <c> <Z>
My combination:
<Compose> <C> <Z>
ā:
Original combinations:
<Compose> <minus> <a>
<Compose> <underscore> <a>
My combinations:
<Compose> <a> <minus>
<Compose> <a> <underscore>
č:
Original combination:
<Compose> <c> <c>
My combination:
<Compose> <C> <c>
ē:
Original combinations:
<Compose> <minus> <e>
<Compose> <underscore> <e>
My combinations:
<Compose> <e> <minus>
<Compose> <e> <underscore>
ģ
Original combinations:
<Compose> <comma> <g>
<Compose> <cedilla> <g>
My combination:
<Compose> <g> <comma>
ī:
Original combinations:
<Compose> <minus> <i>
<Compose> <underscore> <i>
My combinations:
<Compose> <i> <minus>
<Compose> <i> <underscore>
ķ
Original combinations:
<Compose> <comma> <k>
<Compose> <cedilla> <k>
My combination:
<Compose> <k> <comma>
ļ
Original combinations:
<Compose> <comma> <l>
<Compose> <cedilla> <l>
My combination:
<Compose> <l> <comma>
ņ
Original combinations:
<Compose> <comma> <n>
<Compose> <cedilla> <n>
My combination:
<Compose> <n> <comma>
š:
Original combination:
<Compose> <c> <s>
My combination:
<Compose> <C> <s>
ū:
Original combinations:
<Compose> <minus> <u>
<Compose> <underscore> <u>
My combinations:
<Compose> <u> <minus>
<Compose> <u> <underscore>
ž:
Original combination:
<Compose> <c> <z>
My combination:
<Compose> <C> <z>
The problem is, some compose key sequences in Ubuntu do not work correctly. For instance, <Compose key + minus + latin capital A or latin capital O> result in A and O with tildes ("Ã", "Õ"), where the majority of users would expect macrons. ("Ā", "Ō")
The issue has been filed as a bug report and is being worked on. Here is a link to the bug report:
https://bugs.launchpad.net/ubuntu/+source/libx11/+bug/408651
This post is for those who do not wish to wait until a fix is released and prefer to make a quick fix for personal use. It requires you to define your own compose key sequences. Below I am explaining how I did it.
If you would like to learn how to activate and use a Compose key, refer to my earlier thread:
http://ubuntuforums.org/showthread.php?t=1380581
Here is my solution:
First, set up the appropriate input method.
Open the terminal and run the command:
im-switch -cYou will get something like this:
anatoly@NLANGo:~$ im-switch -c
There are 8 candidates which provide IM for /home/anatoly/.xinput.d/ru_RU:
Selection Alternative
-----------------------------------------------
1 default
2 default-xim
3 ibus
4 none
5 scim
* 6 scim-bridge
7 scim-immodule
8 th-xim
System wide default for ru_RU (or all_ALL) locale is marked with [+].
Press enter to keep the current selection
, or type selection number: 2Your selected input method should be default-xim. If the selection is different, change it!
Now log out and log in again
After this is done, try out the compose key sequences you need to use (or example, <Compose> <comma> <k>). Do they work properly? Maybe, some compose characters won't work. For example, when you press <Compose> <minus> <a>, the result is no symbol (while you would expect "ā").
If any of the sequences you need work incorrectly, you are going to adjust them. This is how to do it:
In the Ubuntu system, compose key sequences are stored in the file /usr/share/X11/locale/en_US.UTF-8/Compose
In this file, each compose sequence is defined in one line, which looks something like this:
<Multi_key> <macron> <A> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON(According to the syntax of this file, <Multi_key> means the compose key)
I do not know what is the <macron> key on the keyboard. It is not the hyphen (-), the hyphen is denoted as <minus>. Preferably, to enter characters with macrons, (ā, ō, ū, ī, ē) I want to press the Compose key, the hyphen (dash), and the letter. So, the desired sequence would read <Multi_key> <minus> <a>
Therefore, I decided to replace <macron> with <minus> for all the sequences in the file.
But be careful about editing the file /usr/share/X11/locale/en_US.UTF-8/Compose with sudo!
It is not careful to edit the file /usr/share/X11/locale/en_US.UTF-8/Compose, because it is better to copy it to your home folder, and edit your local version. Copy the file /usr/share/X11/locale/en_US.UTF-8/Compose to .XCompose file in your home folder, by running this command:
cp /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose When you have .XCompose in your home folder, the system will use it instead of /usr/share/X11/locale/en_US.UTF-8/Compose
You can edit ~/.XCompose file without sudo privileges or administrative rights. Moreover, if you accidentally mess up the .XCompose file(it may happen), you will still have the original file, /usr/share/X11/locale/en_US.UTF-8/Compose, intact. So you can delete your old ~/.XCompose and start again.
If there are several users on your computer, you should then create ~/.XCompose file for each user individually.
So, the next steps are:
1) To copy the file /usr/share/X11/locale/en_US.UTF-8/Compose into ~/.XCompose
2) To open .XCompose with a text editor and replace all instances of <macron> with <minus> (do it automatically)
3) I recommend putting comments inside the file to make it readable for you later. Comments are preceded with # and a space.
For example:
# Anatoly replaced all instances of <macron> with <minus>
The changes will not work until you end your session and log in again, but let us do that later. There is one more thing to do.
The following step will make the system easier to use by adding extra intuitive key combinations that are not present in the original file.
The original file now lets you entrer Ā by pressing <Compose> <minus> <A> or, alternatively, <Compose> <underscore> <A>.
However, I think it would be better to add some extra combinations: <Compose> <A> <minus> and <Compose> <A> <underscore>. After doing this, you will be able to input Ā by pressing a hyphen either before, or after pressing A.
So, you add the following lines to ~/.XCompose:
<Multi_key> <A> <minus> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON - added by Anatoly
<Multi_key> <A> <underscore> : "Ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON - added by AnatolyPut your name instead of Anatoly.
Below I give some more examples. Those are the characters I use most (Latvian language). You may want to add your own combinations for your own language. Feel free to search inside ~/.XCompose for the letters you need, and think of any sequences you would find easy to use.
Č:
Original combination:
<Compose> <c> <C>
My combination:
<Compose> <C> <C>
Attention! The combination <Compose> <C> <C> will not work because it conflicts with <Compose> <C> <C> <C> <P>
To make it work, disable the latter combination or change it to a different one.
Ē:
Original combinations:
<Compose> <minus> <E>
<Compose> <underscore> <E>
My combinations:
<Compose> <E> <minus>
<Compose> <E> <underscore>
Ģ
Original combinations:
<Compose> <comma> <G>
<Compose> <cedilla> <G>
My combination:
<Compose> <G> <comma>
Ī:
Original combinations:
<Compose> <minus> <I>
<Compose> <underscore> <I>
My combinations:
<Compose> <I> <minus>
<Compose> <I> <underscore>
Ķ
Original combinations:
<Compose> <comma> <K>
<Compose> <cedilla> <K>
My combination:
<Compose> <K> <comma>
Ļ
Original combinations:
<Compose> <comma> <L>
<Compose> <cedilla> <L>
My combination:
<Compose> <L> <comma>
Ņ
Original combinations:
<Compose> <comma> <N>
<Compose> <cedilla> <N>
My combination:
<Compose> <N> <comma>
Š:
Original combination:
<Compose> <c> <S>
My combination:
<Compose> <C> <S>
Ū:
Original combinations:
<Compose> <minus> <U>
<Compose> <underscore> <U>
My combinations:
<Compose> <U> <minus>
<Compose> <U> <underscore>
Ž:
Original combination:
<Compose> <c> <Z>
My combination:
<Compose> <C> <Z>
ā:
Original combinations:
<Compose> <minus> <a>
<Compose> <underscore> <a>
My combinations:
<Compose> <a> <minus>
<Compose> <a> <underscore>
č:
Original combination:
<Compose> <c> <c>
My combination:
<Compose> <C> <c>
ē:
Original combinations:
<Compose> <minus> <e>
<Compose> <underscore> <e>
My combinations:
<Compose> <e> <minus>
<Compose> <e> <underscore>
ģ
Original combinations:
<Compose> <comma> <g>
<Compose> <cedilla> <g>
My combination:
<Compose> <g> <comma>
ī:
Original combinations:
<Compose> <minus> <i>
<Compose> <underscore> <i>
My combinations:
<Compose> <i> <minus>
<Compose> <i> <underscore>
ķ
Original combinations:
<Compose> <comma> <k>
<Compose> <cedilla> <k>
My combination:
<Compose> <k> <comma>
ļ
Original combinations:
<Compose> <comma> <l>
<Compose> <cedilla> <l>
My combination:
<Compose> <l> <comma>
ņ
Original combinations:
<Compose> <comma> <n>
<Compose> <cedilla> <n>
My combination:
<Compose> <n> <comma>
š:
Original combination:
<Compose> <c> <s>
My combination:
<Compose> <C> <s>
ū:
Original combinations:
<Compose> <minus> <u>
<Compose> <underscore> <u>
My combinations:
<Compose> <u> <minus>
<Compose> <u> <underscore>
ž:
Original combination:
<Compose> <c> <z>
My combination:
<Compose> <C> <z>