From bcbcb3d107a3d991044354129c06e77ce19bda27 Mon Sep 17 00:00:00 2001 From: MRAAGH <33424247+MRAAGH@users.noreply.github.com> Date: Sun, 28 Feb 2021 05:53:40 +0100 Subject: [PATCH] Add suggestion for indirect unicode input on Linux (#10854) * Add suggestion for indirect unicode input on Linux I have used this approach myself with great success, and it seems to be the only good solution that doesn't involve IBus. * Elaborate on keyboard layout on Linux This should be enough to allow people to figure out how to add custom characters to a Linux keyboard layout. --- docs/feature_unicode.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/feature_unicode.md b/docs/feature_unicode.md index 372d8b205..1208ac006 100644 --- a/docs/feature_unicode.md +++ b/docs/feature_unicode.md @@ -126,6 +126,8 @@ The following input modes are available: Enabled by default and works almost anywhere on IBus-enabled distros. Without IBus, this mode works under GTK apps, but rarely anywhere else. By default, this mode uses Ctrl+Shift+U (`LCTL(LSFT(KC_U))`) to start Unicode input, but this can be changed by defining [`UNICODE_KEY_LNX`](#input-key-configuration) with a different keycode. This might be required for IBus versions ≥1.5.15, where Ctrl+Shift+U behavior is consolidated into Ctrl+Shift+E. + Users who wish support in non-GTK apps without IBus may need to resort to a more indirect method, such as creating a custom keyboard layout ([more on this method](#custom-linux-layout)). + * **`UC_WIN`**: _(not recommended)_ Windows built-in hex numpad Unicode input. Supports code points up to `0xFFFF`. To enable, create a registry key under `HKEY_CURRENT_USER\Control Panel\Input Method` of type `REG_SZ` called `EnableHexNumpad` and set its value to `1`. This can be done from the Command Prompt by running `reg add "HKCU\Control Panel\Input Method" -v EnableHexNumpad -t REG_SZ -d 1` with administrator privileges. Reboot afterwards. @@ -270,3 +272,22 @@ AutoHotkey inserts the Text right of `Send, ` when this combination is pressed. If you enable the US International layout on the system, it will use punctuation to accent the characters. For instance, typing "\`a" will result in à. You can find details on how to enable this [here](https://support.microsoft.com/en-us/help/17424/windows-change-keyboard-layout). + +## Software keyboard layout on Linux :id=custom-linux-layout + +This method does not require Unicode support on the keyboard itself but instead uses a custom keyboard layout for Xorg. This is how special characters are inserted by regular keyboards. This does not require IBus and works in practically all software. Help on creating a custom layout can be found [here](https://www.linux.com/news/creating-custom-keyboard-layouts-x11-using-xkb/), [here](http://karols.github.io/blog/2013/11/18/creating-custom-keyboard-layouts-for-linux/) and [here](https://wiki.archlinux.org/index.php/X_keyboard_extension). An example of how you could edit the `us` layout to gain 🤣 on `RALT(KC_R)`: + +Edit the keyboard layout file `/usr/share/X11/xkb/symbols/us`. + +Inside `xkb_symbols "basic" {`, add `include "level3(ralt_switch)"`. + +Find the line defining the R key and add an entry to the list, making it look like this: +``` +key { [ r, R, U1F923 ] }; +``` + +Save the file and run the command `setxkbmap us` to reload the layout. + +You can define one custom character for key defined in the layout, and another if you populate the fourth layer. Additional layers up to 8th are also possible. + +This method is specific to the computer on which you set the custom layout. The custom keys will be available only when Xorg is running. To avoid accidents, you should always reload the layout using `setxkbmap`, otherwise an invalid layout could prevent you from logging into your system, locking you out.