LoginSignup
1

More than 5 years have passed since last update.

posted at

updated at

💥🍣emojiキーを設定しよう🍣💥

この投稿は :calendar: ErgoDox Advent Calendar 2016 の 17日目の記事です。


設定しようと言いつつ、あんまりうまく設定できなかった話を書きます。

emojiどうやったら使えるの?

このへんに話があります。
注意点としてはOSによってやり方が異なるということです。

qmk_firmwareのドキュメント

Unicode support
Home · jackhumbert/qmk_firmware Wiki

読みましょう。

参考ソース

例示されているこのへんを参考にしましょう。

1. Unicode使用設定

keymap.c

#include "process_unicode.h"

Makefile

UNICODEMAP_ENABLE = yes     # Unicode map

2. OS指定

set_unicode_input_mode(UC_***);

qmk_firmware/process_unicode.h at 637170d56043a5a0f11445f605c983e41def2a08 · jackhumbert/qmk_firmware

こちらに定義されているOS値を設定します。

3. キー入力

X(HART2)

設定したOSによって適宜Unicodeが入力されます。

4. 入力ソース設定

OS側でUnicodeを有効にします

で、出来上がりです。

できないんですけど

とりあえずmacOSでやってみたんですけどね。なんか出ないんですよね。

OSX doesn't have any means of inputting unicode over 0xFFFF unfortunately.

えー…。

いちおう、0xFFFF内の☀とかは出せます。U+2600なので。

☀️ Black Sun With Rays Emoji

でも大抵の絵文字は0xFFFF外なんです。

🍣を出したい

使いたい絵文字ってやっぱり🍣 Sushi Emojiじゃないですか。U+1F363じゃないですか。

🍣絵文字キーの実現 - みずぴー日記

そんな風に思っていたらちょうどやってる方が居たので紹介します。
入力メソッドを拡張してそれ用に出力するやり方です。
別解としてサロゲートペアを使えば0xFFFFの範囲内でいけるっぽいです。

Windowsならどうか?

qmk_firmwareのunicodeサポートの中身としてはこんな風になってます。

qmk_firmware/process_unicode.c at 8d60354d5a116b6cb1fc32eac7461eb125543c7d · jackhumbert/qmk_firmware

process_unicode.c
void unicode_input_start (void) {
  switch(input_mode) {
  case UC_OSX:
    register_code(KC_LALT);
    break;
  case UC_LNX:
    register_code(KC_LCTL);
    register_code(KC_LSFT);
    register_code(KC_U);
    unregister_code(KC_U);
    unregister_code(KC_LSFT);
    unregister_code(KC_LCTL);
    break;
  case UC_WIN:
    register_code(KC_LALT);
    register_code(KC_PPLS);
    unregister_code(KC_PPLS);
    break;
  case UC_WINC:
    register_code(KC_RALT);
    unregister_code(KC_RALT);
    register_code(KC_U);
    unregister_code(KC_U);
  }
  wait_ms(UNICODE_TYPE_DELAY);
}

Home · jackhumbert/qmk_firmware Wiki

  • 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.
  • 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.
  • 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.
  • UC_WINC: Windows Unicode input using WinCompose. Requires WinCompose. Works reliably under many (all?) variations of Windows.

説明は上記の通り。

Windowsの場合だと2種類あって、

  • UC_WINのほうではALT押しながらNUMPADで出力
  • UC_WINCのほうではWinComposeを使ってそれ用に出力

となってます。後者のほうがバージョンに依存しないため推奨されているようです。

まとめ

macOS

🍣絵文字キーの実現 - みずぴー日記

入力ソース拡張、またはサロゲートペアを使用。

Windows

WinCompose使う。
→まだうまく出来てないんで、もし出来たら追記します。

Linux

誰か試してください

それでは良き🍣キーライフを!

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
1