http://www.logicool.co.jp/ja-jp/product/wireless-mouse-m560を使おうとした時のことです。ボタンのカスタマイズソフトウェアであるLogicool Control Center for Macintosh OS X
http://support.logicool.co.jp/ja_jp/software/logitech-control-center-for-macintosh-os-xでボタンをカスタマイズしようとしたのですが、このマウスには対応してない言われ、カスタマイズすることができません。M560の中央のスクロールホイールボタンの左右、もしくは右親指あたりにある「進む」・「戻る」ボタンで、WWWブラウザの履歴操作(進む・戻る)をしたかったのです。
調べてみると、スクロールホイールボタンの左右については、これらはマウスの第4、第5ボタンになっているらしく、これをなんとか設定すればよいようです。
Mac OS XでMouse Button4/5をブラウザの戻る/進むにマップする私は、すでにKarabina
http://memo.digitune.org/2014/1129/
https://pqrs.org/osx/karabiner/index.html.jaは使っているので設定をするだけです(私は英語キーボードを使っていますが、日本語キーボードだと設定が違うかもしれません)。
KarabinerのPreference→Change Keyにある「Pointing Device→Button to Key→Use Button4 and Button5 as Back/Foward」の「Set 1」を選びます。
試してみると動きます。
ついでにもう少し調べてみると、
logitech_m560.xmlというKarabinerのM560用の設定が見つかります。Preferenceから見てみると、
https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/include/checkbox/devices/logitech_m560.xml
For Logitech Devicesの下の方に「Logitech M560 mouse Support for extra buttons」というがあります。
さっそく有効にしてみましたが、うまく動きません。
Preferenceの Misc&Uninstallタブにある「Launch EventViewer」を使ってみてみると、ボタンのイベントがブラウザの履歴の進む・戻るのショートカットキーに変換されていません。
KarabinerのM560の設定を見てみました。
- アプリケーションフォルダのKarabierを右クリックし、「パッケージの内容」を選ぶ
- /Applications/Karabiner.app/Contents/Resources/include/checkbox/devices/logitech_m560.xmlを参照する
<device_only>DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_USB_RECEIVER</device_only>とあるように、確かにCmd-RキーをCmd-L+→に変換しています。
<autogen>
__KeyToKey__
KeyCode::COMMAND_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L
</autogen>
よく見ると、
<device_only>DeviceVendor::LOGITECH, DeviceProduct::LOGITECH_USB_RECEIVER</device_only>で、キーが発生したデバイスを限定していますが、これがうまくないのかのしれません。ファイル
/Applications/Karabiner.app/Contents/Resources/deviceproductdef.xmlで定義されているDeviceProductを見てみます。
<deviceproductdef>0xc52bというデバイス番号のようです。
<productname>LOGITECH_USB_RECEIVER</productname>
<productid>0xc52b</productid>
</deviceproductdef>
先ほど使った「Launch EventViewer」のDevicesタブで見てみると、このUSB ReceiverのIDの他にUnifing DeviceというIDもあります。
/Users/<ユーザー名>/Application Support/Karabiner/private.xmlに先ほどの以下のようなlogitech_m560.xmlを少し改変したものを入れていみると、うまく動くようになりました。
<?xml version="1.0"?>
<root>
<deviceproductdef>
<productname>M560x</productname>
<productid>0x402D</productid>
</deviceproductdef>
<item>
<name>Logitech M560x mouse</name>
<appendix>Support for extra buttons</appendix>
<item>
<name>Forward Button to Browser Go Forward</name>
<appendix>Button on the left side of M560x</appendix>
<identifier>device.logitech.m560x.browser.goforward</identifier>
<device_only>DeviceVendor::LOGITECH, DeviceProduct::M560x</device_only>
<autogen>
__KeyToKey__
KeyCode::COMMAND_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L
</autogen>
</item>
<item>
<name>Back Button to Browser Go Back</name>
<appendix>Button on the left side of M560x</appendix>
<identifier>device.logitech.m560x.browser.goback</identifier>
<device_only>DeviceVendor::LOGITECH, DeviceProduct::M560x</device_only>
<autogen>
__KeyToKey__
KeyCode::D, ModifierFlag::COMMAND_L,
KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L
</autogen>
</item>
<item>
<name>Home button (under the wheel) to Mission Control</name>
<appendix>Button in the middle of M560x under the wheel</appendix>
<identifier>device.logitech.m560x.osx.missioncontrol</identifier>
<device_only>DeviceVendor::LOGITECH, DeviceProduct::M560x</device_only>
<autogen>
__KeyToKey__
KeyCode::OPTION_L, KeyCode::COMMAND_L,
KeyCode::CURSOR_UP, ModifierFlag::CONTROL_L
</autogen>
</item>
</item>
</root>