Skip to content

Commit 415d12a

Browse files
committed
Update Unicode docs
1 parent 871169a commit 415d12a

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed

docs/feature_unicode.md

+36-37
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Unicode Support
22

3-
There are three Unicode keymap definition method available in QMK:
3+
There are three Unicode keymap definition methods available in QMK:
44

55
## UNICODE_ENABLE
66

@@ -13,16 +13,16 @@ Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping table
1313
And you may want to have an enum to make reference easier. So you'd want to add something like this to your keymap:
1414

1515
```c
16-
enum unicode_name {
17-
BANG, // ‽
18-
IRONY, // ⸮
19-
SNEK // snke 🐍
16+
enum unicode_names {
17+
BANG,
18+
IRONY,
19+
SNEK,
2020
};
2121

2222
const uint32_t PROGMEM unicode_map[] = {
23-
[BANG] = 0x0203D, // ‽
24-
[IRONY] = 0x02E2E, // ⸮
25-
[SNEK] = 0x1F40D // snke 🐍
23+
[BANG] = 0x203D, // ‽
24+
[IRONY] = 0x2E2E, // ⸮
25+
[SNEK] = 0x1F40D, // 🐍
2626
}:
2727
```
2828

@@ -75,56 +75,55 @@ void qk_ucis_symbol_fallback (void) { // falls back to manual unicode entry
7575
}
7676
```
7777
78-
## Unicode Input methods
78+
## Input Modes
7979
80-
Unicode input in QMK works by inputting a sequence of characters to the OS,
81-
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is input.
80+
Unicode input in QMK works by inputting a sequence of characters to the OS, sort of like a macro. Unfortunately, the way this is done differs for each platform, so a corresponding input mode has to be set.
8281
83-
You can set the input method at any time. You can do this by using a keycode here. The Input method is listed next to the keycode for reference.
84-
85-
|Key |Aliases |Input Method |Description |
86-
|--------------------------|---------|--------------|---------------------------------------------------|
87-
|`UNICODE_MODE_OSX` |`UC_M_OS`|`UC_OSX` |Sets the input method for MacOS X |
88-
|`UNICODE_MODE_LNX` |`UC_M_LN`|`UC_LNX` |Sets the input method for Linux |
89-
|`UNICODE_MODE_WIN` |`UC_M_WI`|`UC_WIN` |Sets the input method for Windows |
90-
|`UNICODE_MODE_WINC` |`UC_M_WC`|`UC_WINC` |Sets the input method for Windows using WinCompose |
91-
|`UNICODE_MODE_OSX_RALT` |`UC_M_OR`|`UC_OSX_RALT` |Sets the input method for MacOS X using RAlt/AltGr |
92-
93-
You can also set the input method via `set_unicode_input_mode(x)`, and this functions the same way as the keycodes above.
82+
The following input modes are available:
9483
9584
* __UC_OSX__: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
9685
* __UC_OSX_RALT__: Same as UC_OSX, but sends the Right Alt key for unicode input
9786
* __UC_LNX__: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
9887
* __UC_WIN__: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
9988
* __UC_WINC__: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
10089
101-
?> Keep in mind that both methods write to EEPROM, and are loaded each time the keyboard starts. So you only need to hit this once.
90+
You can switch the input mode at any time by using one of the following keycodes. The easiest way is to add the ones you use to your keymap.
91+
92+
|Keycode |Alias |Input mode |Description |
93+
|-----------------------|---------|-------------|-----------------------------------------|
94+
|`UNICODE_MODE_OSX` |`UC_M_OS`|`UC_OSX` |Switch to Mac OS X input. |
95+
|`UNICODE_MODE_LNX` |`UC_M_LN`|`UC_LNX` |Switch to Linux input. |
96+
|`UNICODE_MODE_WIN` |`UC_M_WI`|`UC_WIN` |Switch to Windows input. |
97+
|`UNICODE_MODE_WINC` |`UC_M_WC`|`UC_WINC` |Switch to Windows input using WinCompose.|
98+
|`UNICODE_MODE_OSX_RALT`|`UC_M_OR`|`UC_OSX_RALT`|Switch to Mac OS X input using Right Alt.|
10299
103-
!> There are options for BSD, but it is not actually supported at this time. If you use BSD and want support for this, please [open an issue on GitHub](https://github.com/qmk/qmk_firmware/issues)
100+
You can also switch the input mode by calling `set_unicode_input_mode(x)` in your code, and this works the same way as the keycodes above.
104101
105-
### Audio Feedback for Input Mode keycodes
102+
?> Keep in mind that both methods write to EEPROM, so the last used mode is loaded every time the keyboard starts; therefore, you only need to do this once.
106103
107-
If you have the [Audio feature](feature_audio.md) enabled on the board, you can set "songs" for them to play when pressed, so you have some audio feedback when switching modes.
104+
!> There is an input mode option for BSD, but it's not currently implemented. If you use BSD and would like support for this, please [open an issue on GitHub](https://github.com/qmk/qmk_firmware/issues).
108105
109-
For instance, you can add these to your `config.h` file.
106+
### Audio Feedback
107+
108+
If you have the [Audio feature](feature_audio.md) enabled on the board, you can set melodies to be played when you press the above keys. That way you can have some audio feedback when switching input modes.
109+
110+
For instance, you can add these definitions to your `config.h` file:
110111
111112
```c
112-
#define UNICODE_SONG_OSX COIN_SOUND
113+
#define UNICODE_SONG_OSX COIN_SOUND
113114
#define UNICODE_SONG_LNX UNICODE_LINUX
114-
#define UNICODE_SONG_WINDOWS UNICODE_WINDOWS
115-
#define UNICODE_SONG_WIN_COMPOSE UNICODE_WINDOWS
116-
#define UNICODE_SONG_OSX_RALT COIN_SOUND
115+
#define UNICODE_SONG_WIN UNICODE_WINDOWS
116+
#define UNICODE_SONG_WINC UNICODE_WINDOWS
117117
```
118118

119-
### Unicode Input Method Customization
120-
121-
The "start" and "finish" functions for unicode method can be customized locally. A great use for this is to customize the input methods if you don't use the default keys. Or to add visual, or audio feedback when inputting unicode characters.
119+
### Additional Customization
122120

123-
* `void unicode_input_start(void)` - This is called to start the sequence to input unicode characters. It handles calling RAlt or whatever ever sequence you want.
124-
* `void unicode_input_finish (void)` - This is called to cleanup things, such as releasing the RAlt key in some cases, or tapping a key to finish the sequence.
121+
The functions for starting and finishing Unicode input on your platform can be overridden locally. Possible uses include customizing input mode behavior if you don't use the default keys, or adding extra visual/audio feedback to Unicode input.
125122

126-
You can find the default functions in [`process_unicode_common.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode_common.c).
123+
* `void unicode_input_start(void)` – This sends the initial sequence that tells your platform to enter Unicode input mode. For example, it presses Ctrl+Shift+U on Linux and holds the Option key on Mac.
124+
* `void unicode_input_finish(void)` – This is called to exit Unicode input mode, for example by pressing Space or releasing the Option key.
127125

126+
You can find the default implementations of these functions in [`process_unicode_common.c`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode_common.c).
128127

129128
## `send_unicode_hex_string`
130129

0 commit comments

Comments
 (0)