6

I know we can insert some unicode characters by pressing ALT+[code] combination under Windows, right? I would like to have a similar option under Ubuntu, however in addition to that I'd need to choose my shortcut keys and text to be inserted. For example, I want to insert "⭐" character with a combination (it doesn't matter what combination, it may be even ALT + SHIFT + CTRL + 123).

Is this even possible?

anand mbs
  • 431
mtszkw
  • 223

3 Answers3

5

You can hit Ctrl+Shift+U, type an Unicode code point and hit Enter to insert the character bound to that Unicode code point;

For example, to insert :

  • Hit Ctrl+Shift+U
  • Type 2b50
  • Hit Enter

I suggest you to keep using this method, as most Ctrl+[...], Alt+[...] and Shift+[...] sequence will end up conflicting with other functions; however if you really want to use a custom shortcut, you can try your luck and bind a custom shortcut to an xdotoolcommand in System Settings > Keyboard > Shortcuts > Custom Shortcuts; for example, the xdotool command to insert would be:

xdotool key --window '$(xdotool getactivewindow)' Ctrl+Shift+U2B50
kos
  • 41,268
5

Alternatively you can enable compose keys to create these symbols or even strings of text with ease without remembering these annoying keyboard number-letter combinations.

Open GEdit and insert the following:

include "/usr/share/X11/locale/en_US.UTF-8/Compose"

<Multi_key>     <1>     <2>     <3> : "Your text"   # Quick description
<Multi_key>     <s>     <t>     <a> : "⭐"  U2B50    # Star Symbol

Save this as .XCompose (case sensitive) in your home directory.

Open your keyboard settings (system settings → keyboard settings) and go to the shortcuts tab. Under the "typing" section you'll find a "Compose Key" setting. Set this to your compose key (I advice right alt)

Gnome Compose Key setting for gnome
Unity Compose Key setting for Unity Xfce
Compose Key setting for xfce. Source: wikipedia Compose Key

Log out and log back in.
To quickly summon your text press the following keys in sequence Compose Key123.
Just replace 1,2,3,4,5 etc etc with whatever keys you want to use.

If it isn't working add

export GTK_IM_MODULE="xim"

to the end of ~/.profile. If xim isn't working for you you'll have have to install uim (sudo apt-get install uim) and replace the xim in ~/.profile with uim and logout and log back in.

Akisame
  • 3,343
2

I have configured AutoKey to insert the

For example, to insert :

  • Hit Ctrl+Shift+U
  • Type 2b50
  • Hit Enter

enter image description here

to install AutoKey read:

https://askubuntu.com/a/799654/110556

List of unicodes:

https://en.wikipedia.org/wiki/List_of_Unicode_characters#Currency_Symbols https://en.wikipedia.org/wiki/Star_%28glyph%29

BOB
  • 671