Macで英語配列のRealforceを使う

環境

RealforceWindows用キーボードなので、デフォルトではWinキーはCommand、AltキーはOptionに割り当てられたり等、Mac用のキーボードとかなりレイアウトが異なります。ここではKarabiner(旧KeyRemap4MacBook)、Seil(旧PCKeyboardHack)を使ってMac用キーボードのレイアウトに近づける方法を紹介します。

まずは以下2つのソフトをインストールして下さい。
- Karabiner
https://pqrs.org/osx/karabiner/index.html.ja
- Seil
https://pqrs.org/osx/karabiner/seil.html.ja

CtrlとCaps Lockの入れ替え

この変更は鉄板ですね。色々方法はありますが、僕はRealforceDip Switch 1を使用しました(スイッチをONにすると入れ替え)。USBを一旦抜かないと有効にならないので注意。

Option、Commandキーの入れ替え

System Preferencesのキーボード設定でモディファイアキーを以下のように設定します。キーボード選択ボックスでRealforceを選択してから設定して下さい。Caps LockをNo Actionにするのは後でSeilを使ってCaps LockにFnキーを割り当てるためです。

  • Caps Lock -> No Action
  • Option -> Command
  • Command -> Option

Caps LockをFnに

SeilでCaps Lockに未使用のキー(今回はF19を使用)を割り当てます。(Fnキーは63となっていますが、63ではFnキーとして動作しません)

Karabinerのprivate.xmlを編集してF19をFnキーに割り当てます。private.xmlの読み込み方についてはhttps://pqrs.org/osx/karabiner/document.html.jaを参照して下さい。

<item>
<name>F19 Key to Fn (Change CapsLock to F19(80) in Seil)name>
<identifier>remap.f192fnidentifier>
<autogen>__KeyToKey__ KeyCode::F19, KeyCode::FNautogen>
item>

Fn+F1,F2…F12の特殊キーを有効

ディスプレイをスリープ(Ctrl+Shift+Eject)のショートカットを設定

この設定はBetterTouchToolを使って行います。
http://blog.boastr.net/downloads-secondbar-bettertouchtool-2/

ApplicationキーをOptionに割り当て

Karabinerのprivate.xmlに以下を追加。Realforceのキーボードのみで有効になるようにしています。

  <devicevendordef>
<vendorname>TopreCorporationvendorname>
<vendorid>0x853vendorid>
devicevendordef>

<item>
<name>App to Optionname>
<identifier>private.deviceproductdef.topre.app_to_optionidentifier>
<device_only>DeviceVendor::TopreCorporationdevice_only>
<autogen>--KeyToKey-- KeyCode::PC_APPLICATION, KeyCode::OPTION_Rautogen>
item>

Home/Endキーの設定

private.xmlに以下を追加。

  <item>
<name>Home/Endname>
<identifier>private.deviceproductdef.topre.home_endidentifier>
<device_only>DeviceVendor::TopreCorporationdevice_only>
<autogen>--KeyToKey-- KeyCode::HOME, KeyCode::CURSOR_LEFT, VK_COMMANDautogen>
<autogen>--KeyToKey-- KeyCode::END, KeyCode::CURSOR_RIGHT, VK_COMMANDautogen>
item>

かな・英数の切り替え

Macでの日本語入力モードの切り替え方法は悩ましいですが、僕はワンショットモディファイアを使用しています。Shiftだけを押すとかな、Altだけを押すと英数に切り替わるようになっています。

<item>
<name>When type Command_L only, send JIS_EISUU(except in Virtual Machine, RDC)name>
<identifier>private.cmdL_only_to_eisuuidentifier>
<not>VIRTUALMACHINE, REMOTEDESKTOPCONNECTIONnot>
<autogen>--KeyOverlaidModifier--
KeyCode::COMMAND_L, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
KeyCode::COMMAND_L, KeyCode::JIS_EISUU
autogen>
item>

<item>
<name>When type Shift_L only, send JIS_KANA(except in Virtual Machine, RDC)name>
<identifier>private.shiftL_only_to_kanaidentifier>
<not>VIRTUALMACHINE, REMOTEDESKTOPCONNECTIONnot>
<autogen>--KeyOverlaidModifier--
KeyCode::SHIFT_L, ModifierFlag::SHIFT_L | ModifierFlag::NONE,
KeyCode::SHIFT_L, KeyCode::JIS_KANA
autogen>
item>

private.xmlのまとめ

ここまで紹介したprivate.xmlをまとめたものを以下に貼ります。

  
<devicevendordef>
<vendorname>TopreCorporationvendorname>
<vendorid>0x853vendorid>
devicevendordef>

<item>
<name>Topre Realforcename>

<item>
<name>F19 Key to Fn (Change CapsLock to F19(80) in Seil)name>
<identifier>remap.f192fnidentifier>
<autogen>__KeyToKey__ KeyCode::F19, KeyCode::FNautogen>
item>

<item>
<name>App to Optionname>
<identifier>private.deviceproductdef.topre.app_to_optionidentifier>
<device_only>DeviceVendor::TopreCorporationdevice_only>
<autogen>--KeyToKey-- KeyCode::PC_APPLICATION, KeyCode::OPTION_Rautogen>
item>

<item>
<name>Home/Endname>
<identifier>private.deviceproductdef.topre.home_endidentifier>
<device_only>DeviceVendor::TopreCorporationdevice_only>
<autogen>--KeyToKey-- KeyCode::HOME, KeyCode::CURSOR_LEFT, VK_COMMANDautogen>
<autogen>--KeyToKey-- KeyCode::END, KeyCode::CURSOR_RIGHT, VK_COMMANDautogen>
item>

<item>
<name>When type Command_L only, send JIS_EISUU(except in Virtual Machine, RDC)name>
<identifier>private.cmdL_only_to_eisuuidentifier>
<not>VIRTUALMACHINE, REMOTEDESKTOPCONNECTIONnot>
<autogen>--KeyOverlaidModifier--
KeyCode::COMMAND_L, ModifierFlag::COMMAND_L | ModifierFlag::NONE,
KeyCode::COMMAND_L, KeyCode::JIS_EISUU
autogen>
item>

<item>
<name>When type Shift_L only, send JIS_KANA(except in Virtual Machine, RDC)name>
<identifier>private.shiftL_only_to_kanaidentifier>
<not>VIRTUALMACHINE, REMOTEDESKTOPCONNECTIONnot>
<autogen>--KeyOverlaidModifier--
KeyCode::SHIFT_L, ModifierFlag::SHIFT_L | ModifierFlag::NONE,
KeyCode::SHIFT_L, KeyCode::JIS_KANA
autogen>
item>
item>