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)?
8 Answers
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.
- 1,277
- 1
- 15
- 29
-
+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
-
Add them to `/usr/include/X11/keysymdef.h` in the `#ifdef XK_LATIN1` section and recompile X. You should now be able to type them via Compose key. – daxim Aug 23 '15 at 19:00
-
2Using 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 07:31
-
[Sometimes one has to "unask" the question.](https://interpersonal.meta.stackexchange.com/q/2511) /// kragen xcompose contains ☠, it is made usable by the system by copying a file, it can't get easier than that. – daxim Jul 24 '18 at 09:33
-
3Compose 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 07:01
-
Besides, messing around with compose or even recompiling X is NOT a viable solution for a lot of users! – Christian Hujer Oct 30 '18 at 07:02
-
Christian, your assessment is wrong. It only makes sense if one ignores the existence of [character map applications](https://utils.kde.org/projects/kcharselect/). Also, copying a file into the home directory is always a viable solution for any user. – daxim Oct 30 '18 at 19:39
-
2I 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 07:35
-
The point is also about this: I already have memorized lots of codepoints. I know that U+2022 is the middot, U+21D2 is the double arrow right, and so on. I have memorized that U+FE0F is emoji and U+FE0E is text mode. I have memorized more code points than reasonably can be memorized using keyboard shortcuts. All I want, and probably the OP as well, is an efficient way to enter this. We do not want to force other people to memorize codepoints. We want a solution for people that have memorized or work with codepoints. For us, mapping specific code points does not work. – Christian Hujer Aug 19 '20 at 07:39
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.
- 11,278
- 19
- 67
- 96
Yet another method to type Unicode character in KDE is to use KRunner — it has Special Characters plugin enabled by default. Hit Alt + Space and enter #code and press Enter. For example, #2019 will produce single quotation mark. Still needs copy/paste though.
You can set aliases for the frequently used combinations in plugin's settings. For example, if you set sq alias for the code 2019 you can type #sq in KRunner and get the same result.
If these aliases don't work at once, restart KRunner with kquitapp5 krunner command (it was a bug in older Plasma 5 versions which should be fixed now).
- 141
- 4
Have a look at this article: Unicode Easy Keyboard Layout for XKB
- 5,128
- 3
- 29
- 39
-
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 01 '20 at 19:32
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.
- 11
- 2
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.
- 184
- 5
There's a systemic bug there. I have 2 workarounds, using xdotool
- install xdotool (
apt install xdotool). - 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 keyupmultiple 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,385
- 3
- 18
- 33
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).
- 1