34

This answer has tips on how to do it on Gnome or Vim, but these don't work on KDE. This bug shows that KDE don't support the ISO notation with Ctrl+Shift plus the character's hex code. Is there any other way I can do this with a keyboard (that is, without copying and pasting)?

25

Memorising hexcodes is madness. Use the compose key instead. It lets you combine characters in a mnemonic way. This is a feature of X, not just KDE, thus works everywhere. Some examples:

  • Compose, v, C   →   Č
  • Compose, ´, E   →   É
  • Compose, _, u   →   ū
  • Compose, ^, i   →   î
  • Compose, ,, S   →   Ş
  • Compose, +, o   →   ơ
  • Compose, ;, a   →   ą
  • Compose, U, g   →   ğ
  • Compose, ", u   →   ü
  • Compose, °, A   →   Å
  • Compose, ~, N   →   Ñ
  • Compose, +, -   →   ±
  • Compose, ., >   →   ›
  • Compose, ., .   →   …
  • Compose, ., =   →   •
  • Compose, P, !   →   ¶
  • Compose, !, ^   →   ¦
  • Compose, !, !   →   ¡
  • Compose, ?, ?   →   ¿
  • Compose, s, s   →   ß
  • Compose, o, e   →   œ
  • Compose, O, E   →   Œ
  • Compose, a, e   →   æ
  • Compose, A, E   →   Æ

Each key is typed sequentially without holding down. See the file /usr/share/X11/locale/en_US.UTF-8/Compose (online, 124 KiB) for the whole list. You can define your own compose sequences in your ~/.XCompose file (example).

Since I do not have a Sun keyboard, I do not have a physical Compose key. I remap the useless Caps Lock key as logical Compose key. Change this in System Settings → Region/Language → Keyboard Layout (kxkb applet) → tab Advanced → section Compose key position, or run the command setxkbmap -option compose:caps.

10
  • +1 "Memorising hexcodes is madness." → Couldn't agree more, but I'm surprised that my compose file doesn't contain some useful characters, like ✓ (u2713). The GitHub you linked to is supremely useful. – Mark E. Haase Aug 18 '14 at 16:53
  • 2
    @daxim and if I need to enter ascii control characters? – user2284570 Aug 20 '15 at 18:24
  • 2
    Using the compose key is indeed helpful. But this answer does not answer the original question. AFAIK there's no method in KDE at the moment that would allow inserting any Unicode character using it's code. E.g. how would you type U+2620, i.e. ☠? The only way is to add a custom key combo, which is not ideal. – teekarna Jul 24 '18 at 7:31
  • 3
    Compose is not a solution. The number of possible characters that I would like to type from the unicode exceeds what is mappable with compose in a mnemonic way. Memorizing non-mnemonic compositions is equal madness. And there's characters like RTL, LTR, RTL-override, Variant selection, Unicode flags, all those various emojis, and so forth - I'm fine with memorizing hex codes, and sometimes I haven't memorized a hex code, but look it up and just want that to type that character by hex code. Compose is not an answer, and unasking this question is not helpful but ignorant! – Christian Hujer Oct 30 '18 at 7:01
  • 2
    I disagree that memorizing arbitrary combinations with mnemonics that are specific to Xorg is better than memorizing arbitrary combinations without mnemonics that are universal. – Carolus May 18 '19 at 7:35
11

Here is the KDE bug on the issue: https://bugs.kde.org/show_bug.cgi?id=103788

I addressed this issue in an article that deals with typing RTL text. Although in most common desktop environments Unicode symbols can be typed by holding the Alt key and pressing the numeric keypad plus sign then the Unicode value in hex, KDE users cannot use this method as KDE relegates responsibility for implementing this feature to Xorg, and Xorg relegates to Qt, and Qt relegates back to Xorg.

3

Have a look at this article: Unicode Easy Keyboard Layout for XKB

1
  • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change. – DavidPostill Apr 1 '20 at 19:32
1

Install ibus-gtk3 (other input method frameworks, and certainly other ibus UIs may provide similar features, but this is what I tested).

This provides a unicode input dialog under the label of "Emoji choice". The default shortcut to bring this up is Ctrl+Shift+E.

You may have been hoping for a dialog-less solution, but it can still be used, efficiently, with the keyboard alone, i.e. Ctrl+Shift+E, [hexcode], Enter. This method also seems to work across apps of different toolkits, including KDE / Qt apps, Libreoffice, Chromium, Firefox, xterm, etc.

0

For the editors Kate and Kwrite or Kdevelop, I have found a solution in a blog post: one can type F7, or alternately in the menu "View -> Switch to Command Line", then in the command line, one can type eg char x2208 and this inserts the character ∈ or U+2208 in the editor window.

0

There's a systemic bug there. I have 2 workarounds, using xdotool

  1. install xdotool (apt install xdotool).
  2. Create a custom shortcut with the script as action (New > Global Shortcut > Command/URL; Trigger: (your key combo)

Workaround #1 - sleep

Add a sleep command before calling xdotool:

sleep 0.6
xdotool type "¯\\_(ツ)_/¯"

Woraround #2

Release the shortcut keys before calling xdotool:

xdotool keyup Super+n
xdotool type "¯\\_(ツ)_/¯"

notes:

  • in my case, the script can be called by multiple shortcut keys. So I call xdotool keyup multiple time, for each key-combo.

  • use double quotes. Don't ask me why. Not required for a single key.

  • Escape the single backslash, i.e. "¯\\_(ツ)_/¯"

  • The reason for the workarounds, is that the key combo is using the meta key. If the meta key is pressed while the unicode code is sent to the current app, then Plasma is sending garbage to the current app / to the window management. With a small delay, it doesn't happen.

  • xdotool sends it to the currently active window by default.

  • This is obviously a big, ugly and fragile hack, NOT a rock solid feature. YMMV.

  • There are numerous KDE bugs around this feature, one of them is about reusing old shortcuts. If it doesn't work immediately, I recommend logout / restart.

-1

Reading the bug data its said GTK2+ windows still allow this resource to be used and I can confirm that using something like "gedit" allowed to use again unicode chars on KDE plasma.

I know this is an old thread but it seems no one mentioned this earlier so decided to leave here my very first update on superuser.

It's not ideal but it helps a ton .. I use both unicode and also the compose key (mapped to my right alt key) but I definitely prefer unicode as it has a huge amount of chars available and easy to use (IMO).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.