# What's the best way to actually "type" special UTF-8 chars?

Everything on my system (that needs it) supports UTF-8 just fine.
That's all nice when you want output... But what if you want easy input ?

At the moment the only non-ASCII chars I can easily type are chars like é by using AtlGr.
But for chars like ₂ ² ≈ √ π 😀 at the moment I have to:

1. Open a browser
2. Surf to https://www.utf8icons.com or a similar site
3. Click, type and search a lot on the site to get to a page that contains the symbol i want
4. Copy it
5. Paste it in the program where I need it
6. (Optionally) close the browser

What I'm looking for is a program that can do something like this:

• Run in the background in a modern desktop environment (in my case Cinnamon)
• Jump to the foreground to show a whole list of reasonably popular UTF-8 symbols after pressing something like F1
• Let me click a symbol after which it will be sent to the program I was last using as if it was a keypress
• Give me the option to configure it to either stay visible after this "fake keypress" or jump back to background

In short: Are there virtual keyboard programs with support for non-ASCII UTF-8 ?

Actually... I am already happy with any method that improves mine.

Feel free to add extra solutions below (after providing them as detailed answer)
:

• ibus (usually with CtrlShiftE) → Can't get it to work on Cinnamon
• onboardpro: Seems to do everything I need + has support for snippets, con: Only (by default) included non-latin layout is for math, other layouts with popular UTF-8 chars have to be created manually
• gucharmappro: Lots of chars and easy to search con: Doesn't easily jump between foreground/background (can probably be handled with a workaround in Cinnamon itself)
• kcharselect→ Same pro/con as gucharmap
• Solutions from the programs themselves (e.g. Ctrl. for a couple of them) → pro: Ideal for that exact program con: Most programs, including the ones where it's needed the most, don't have one + it's not uniform
• https://www.unicodeit.net/pro: Good for long math formula's. con: Same problem as the one I originally stated + useless for non-math symbols
• Keyboard with extra symbolspro: Easy con: Small amount of chars + extra keyboard needed for each system
• Shortcuts for the most used chars with xcomposepro: Easy con: Depending on your memory (as human, not as computer) it only works for a limited amount of chars
• HTML entities to compose - pro/con: Too much of each, see answer
• Use CtrlShiftU, Hexcode,Space: pro/con: Same as above
• Is XCompose in scope, or do you specifically want a GUI? Apr 10 '21 at 8:53
• If I remember correctly XCompose let's you define key-combinations to be interpreted as a certain char. Once you have > 20 chars it becomes hard to remember, a GUI would be better.
– Garo
Apr 10 '21 at 8:59
• One problem with the way you are thinking about this is the massive number of available characters in Unicode, with others being added. The definition of "popular" is deeply subjective and very prone to errors. It would be better to search for tools centred around specific groups of characters or tasks. For example if you are wanting mathematical characters, look for a math tool, if you are wanting Chinese characters look for a Chinese keyboard tool. Apr 10 '21 at 10:29
• @PhilipCouling: This could be done by a dropdown menu where you can choose a required a subset. (And maybe even a setting that lets you add a extra option to the dropdown menu where you can add your favorites)
– Garo
Apr 10 '21 at 12:24
• Compose is great for things you need often, like typographical quotes or accent characters, but most other stuff I look up in gucharmap. Apr 10 '21 at 18:14

You could use Onboard Onscreen Keyboard which is available in most distros.

It allows to create a custom layout with the characters you need, e.g.

In case you don't want to create a new layout it offers a feature called "Snippets" where you have the choice of entering different characters or even text.

In order to show it just create a shortcut in your desktop environment which will simply execute onboard or dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.Show

In order to hide it create a shortcut for dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.Hide

Or you could toggle visibility with dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.ToggleVisible

• Promising... Regular math is already included although it's a bit strange that i have to go the settings menu and access the contributions options to get to the part with the math keys. I'll play around with it a bit, there might be a way around it. Snippets seems easy to reach, i like that.You already have my upvote and this might become the "accepted answer" in a week or so.
– Garo
Apr 10 '21 at 19:49

Actually... I am already happy with any method that improves mine.

If you're using symbols often enough to remember their hex codes:

GTK-based UI applications (a.k.a. an overwhelming portion of them) will let you press Ctrl+Shift+U and then type a Unicode hexcode, pressing Space to indicate you've finished the hexcode.

For example, from memory:

[ctrl+shift+u] 3c0 [space]

gives you π (U+03C0 GREEK SMALL LETTER PI),

[ctrl+shift+u] 1f431 [space]

gives you 🐱 (U+1F431 CAT FACE), and

[ctrl+shift+u] 2014 [space]

gives you — (U+2014 EM DASH).

In applications based on Qt, EFL, or anything that doesn't ultimately use GTK, this won't work, but it's not too hard to pop open a GTK-based application like a text editor and use the ctrl+shift+u interface and then copy it out.

• Depending on your memory, it works for about 20 chars, after this you are stuck...
– Garo
Apr 10 '21 at 20:00
• This is pretty great for people that are used to typing Alt codes on Windows. Only they'd have to convert the codes they remember from decimal to hex before using.
– JoL
Apr 10 '21 at 20:54
• @JoL on Windows you also have to use hex to type code points larger than 255 after setting up EnableHexNumpad Apr 11 '21 at 5:27
• "an overwhelming portion of them" — it's only so if you use GTK-based desktop environments like GNOME or XFCE. Not at all when using e.g. KDE. Apr 11 '21 at 9:25
• @Ruslan There's no need for desktop environments. I don't use any desktop environment and I could still use this feature on GTK apps, like on the Firefox address bar.
– JoL
Apr 11 '21 at 18:30

Most modern OSes have an emoji picker for typing emojis, kaomojis and special symbols. For example in Ubuntu and many other Linux distros you use Ctrl+. to open it

Depending on your settings and your distro you may need to install some additional packages or use another shortcut like Ctrl+Shift+E or Ctrl+Alt+E. See

FWIW in Windows you activate it by Windows+. or Windows+; then search by name

In macOS it's ^++Space

• For me, this works in Mousepad, Atril, and Evince, but not Firefox, Libreoffice or my terminal emulator (xfce4-terminal). The IBus method works for me in all six. Apr 11 '21 at 2:53
• Also fails in Thunderbird and my terminal emulator (guake). These (and the already mentioned Firefox and LibreOffice will be probably be the 4 programs where I'll use it the most
– Garo
Apr 11 '21 at 4:41
• @Garo did you try enabling IBus and use Ctrl+Shift+E? Apr 11 '21 at 5:28

For math-y stuff, if you know latex, then I highly recommend (and, if you don't know latex, I'd recommend learning the subset necessary to use):

https://www.unicodeit.net/

Type in latex on the left and you get copy-and-paste unicode on the right (at least to the extent that Unicode can support Latex). Good for subscripts, supeprscripts, all sorts of mathematical operators, etc.

For example, typing:

\hat{u} = \Pi_i\cdot\hat{v}\times\int_af(\theta)d\theta

yields

û = Πᵢ⋅v̂×∫ₐf(θ)dθ

(note, the math in this example is, of course, gibberish.)

• I know \LaTeX{}, no problem there, but it's just my openbrowser-surf-clickandtype-copy-paste-closebrowser method again, the only difference is the emphasis now goes to the typing instead of the clicking.
– Garo
Apr 10 '21 at 19:56

Have you considered a hardware solution? Maybe a customisable second keyboard?

The Art Lebedev Optimus Popularis: https://www.artlebedev.com/optimus/popularis/

Or even an Elgato Stream Deck XL: https://www.elgato.com/en/stream-deck-xl

• Would be a possibility but I use too many systems for this and not even all of them are mine (although they all run some Linux distribution)
– Garo
Apr 11 '21 at 4:44

I don't know if Cinnamon comes with IBus, but I know that IBus works in several DEs (I use it in XFCE, I used to use it in LXDE, and I've seen it used on GNOME).

With IBus, you can configure a keyboard shortcut (Ctrl+Shift+e by default) to input "emoji" with. When you type that shortcut, you can type a word related to the character you are looking for and then Space twice, and it will bring up an overlay with several characters having that word in their description.

Despite the name of the feature, it is not limited to emoji. For example, typing Ctrl+Shift+e "math" Space Space, brings up this overlay with several emoji and other Unicode characters that contain "math" in their annotations. You can press Escape once to exit the overlay, Escape again to change the keyword to search for, and Escape again to cancel entering a special character and go back to normal typing.

• Fails here (Cinnamon 4.8.6 on Mint 20.1). IBus itself seems to work because I notice that it switches my keyboard layout to the default one. But actually trying to use keybindings to get to the utf-8 symbols or to go to the next layout fails, I assume Cinnamon overwrites these keybindings.
– Garo
Apr 11 '21 at 14:41

My favourite solution is to convert HTML character references into custom Compose key sequences, and then use those.

• Low-tech, should work in virtually all X11 clients that support X input methods
• Allows you to input Cyrillic, Greek, arrows, mathematical symbols and box-drawing characters
• HTML entities are relatively easy to memorise: much easier than code point numbers, with the names often following memorable patterns: Cyrillic letters are available under their English transliterations followed by cy; Greek letters are available under names of the letters; arrows are &⟨direction⟩{A|a}rr;; double-struck mathematical letters are suffixed by opf; capital letter denotes a doubled line or capital, etc. You can look at the list of entities and figure out some mnemonics yourself.
• Transferable knowledge (and I think this is a killer feature): having the entity names memorised can be advantageous even when you aren’t working in an environment configured to your liking. Entity names can be used directly when authoring Markdown or HTML in a text editor. In the worst case, you can open a browser and navigate to a data: URI like data:text/html,&exist; to obtain a copy-pastable character you want. Mathematical notation symbols are often available under the same names as their control sequences in TeX (with some exceptions), so knowing TeX will help you learn entity names and vice versa.

• There are no HTML entities for emoji
• IBus doesn’t seem to support custom Compose sequences at all, so you’ll have to stop using it (and this might be a deal-breaker) As of IBus 1.5.25, this has been fixed, and the steps below work just fine! (Apparently thanks to this commit.)
• In XIM, Compose key sequences are limited to eight characters, so entities with names longer than 6 characters will be unavailable
• Some entity names are pretty long (though the previous point makes it moot)
• In XIM, if you make a typo in a name, you get no feedback and will have to start typing the entity name from the beginning
• I would assume Compose sequences haven’t been ported to Wayland at all.

Now, how to make this happen:

1. Make sure your input method supports the Compose key and the key is enabled and assigned in your keymap to a physical key.
2. Download entities.json.
3. Run it through the script below, redirecting standard output to a path like ~/.local/share/entities.Compose.
4. Add a directive like include "%H/.local/share/entities.Compose" to ~/.XCompose.
5. The setting should take effect when you restart your X11 apps.

Script:

#!/usr/bin/env python3
import sys
import json
import unicodedata

for entity, value in json.load(open('entities.json', 'r')).items():
if not (entity.startswith('&') and entity.endswith(';')):
print(f'Skipping {entity}', file=sys.stderr)
continue

entsyms = ' '.join(f'<{c}>' for c in entity[1:-1])
chars = ''

codepoints = value.get("codepoints")
if codepoints is None:
codepoints = [ord(c) for c in value["characters"]]

print()
for oc in codepoints:
print(f'# {f"U+{oc:04X}":<7}  {unicodedata.name(chr(oc), "<???>")}')
if oc == ord('\"') or oc == ord('\\') or 0x00 <= oc <= 0x1f:
chars += f'\\{oc:o}'
else:
chars += chr(oc)

keysym = ''
if len(codepoints) == 1:
keysym = f'U{codepoints[0]:04x}'

print(f'<Multi_key> <ampersand> {entsyms} <semicolon> : "{chars}" {keysym}')


I don't believe this ... All these prior answers and nobody, no one, not a single person has suggested ... Emacs.

Emacs makes this very very simple, simpler than any of the above solutions.

Type C-x 8 <RET> (or M-x insert-char) and then start typing a description of your unicode character of choice. A vanilla emacs will offer TAB completion of your partial descriptions, but most people using emacs use an extension such as ivy, edo, helm, or icicles all of which dynamically present completion candidates as you type.

For example, if you begin typing the string calc, you are presented with options runic letter calc and pocket calculator. Some of the emacs extensions mentioned above also provide previews of the characters to be inserted.

Once you have inserted characters into an emacs buffer, you -could- copy and paste it to your application of choice, but you could just as well replace that application with emacs itself. Just as a for instance, emacs has several versions of shells and terminal emulators, so you can M-x ansi-term to get a terminal instance, and then use M-x insert-char directly into its command-line.

EDIT: With the ivy package installed, typing C-h u runs M-x counsel-unicode-char which is also pretty nifty.

• "Replace that application with emacs itself"...Why would you want to replace application-where-you-want-to-enter-unicode with emacs ? Could it be that you mean it the other way around ?
– Garo
Apr 23 '21 at 12:27
• Apr 25 '21 at 1:28
• Emacs... The OS disguised as editor. Once I have 14 fingers I'll switch from vim to emacs but until then I wouldn't call this a solution.
– Garo
Apr 25 '21 at 16:56