Score:0

How to make shortcuts for typing special characters?

br flag

I am using as OS Ubuntu 20.04.6 LTS and I have an American keyboard. From time to time I need to type Russian special characters (e.g. ё). Is there a way/program to create my own custom shortcuts that will type out my desired characters (e.g Alt+e+~ = ё)?

zwets avatar
us flag
Do you mean setting custom shortcuts _other than_ the standard ones provided by the compose key, as described in [this answer](https://askubuntu.com/a/731744/134479)?
Javier Z. avatar
it flag
The *nix way to do so is briefly explained [here](https://unix.stackexchange.com/questions/254477/linux-alternative-to-altnumpad-codes)
NeStack avatar
br flag
@zwets Yes, I want to choose my own combination for typing the special character, I don't want to use a predefined one
NeStack avatar
br flag
@JavierZ. Thanks, but is there a way to choose my own sequence of strokes that will trigger the typing of the special character?
Score:1
sh flag
Art

Your keyboard shortcuts (in the main for special characters) are assigned in the file usr/share/X11/locale/en_US.UTF-8/Compose If you want to add your own: use a text editor to create a new file in your Home directory named .XCompose with contents

include "%L"

<Multi_key> <t> <q> : "the quick brown fox"
<Multi_key> <e> <asciitilde> : "ё"

where include "%L" brings in the default sequences and the other lines specify the key sequences and their resultant text. Others can be appended to the file contents.

In this case we're using 'Multi_key' also know as 'Compose' as the first designator. As modern keyboards don't tend to have a 'Compose' key you'll need to assign one on your keyboard. I use 'Alt Gr' aka 'Right Alt'. To do so go into Settings - Keyboard. Select Layout and Options. Scroll down to find '> Position of Control Key' and assign it to the key you want to use (e.g. Right Alt).

Now when you type the sequence 'Right Alt' t q the text the quick brown fox appears.

Note that having made any changes to your .XCompose file you'll need to restart the application you're typing into (e.g. xed or LibreOffice Writer).

NeStack avatar
br flag
Welcome to the community and thanks a lot! I will try it out and I will reply again, if it doesn't work
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.