How can I modify button behavior for PC-only mice on Mac that don't emit USB-standard key events? [closed]

Solution 1:

Better Touch Tool does what you want. I've just downloaded it and am thoroughly enjoying it: http://www.boastr.net/

I believe it's also available on the Mac App store.

It supports:

  • Magic Mouse
  • Macbook Trackpad
  • Magic Trackpad
  • keyboard shortcuts
  • normal mice
  • Apple Remote

Solution 2:

I had a similar issue with the Logitech M560 mouse on my MacBook Air. I LOVE this mouse! It has 5 buttons plus a tilt wheel, real rubber grips (not that spray-on stuff that gets gummy after a year), 1 year battery life and best of all... weighs a mere 92 grams with a Lithium cell!!! So awesome. But it's not Mac-Compatible at all and none of the third party USB drivers work with it. That's because some of the buttons don't send USB button click events at all (a pretty poor practice if you ask me) but rather send hard-coded keyboard shortcuts / touch events that are Windows-specific. USB Overdrive and SteerMouse only look for USB click events so they can't "find" most of the buttons.

I found a solution though!

  1. Download Karabiner: https://pqrs.org/osx/karabiner/
  2. Install, Launch and give it permission in "System Preferences > Security"
  3. In the app click "Open private.xml" under the "Misc & Uninstall" tab
  4. Create device-specific re-mappings to do whatever you want! (Documentation on editing the XML: https://pqrs.org/osx/karabiner/xml.html.en)

Since some of the M560 buttons send Windows-only keystrokes that a Mac can't understand, in some cases the only keystrokes your Mac will "see" are a command or option keystroke! But it's safe to re-map those since the re-mapping is device-specific. They ONLY fire when sent from your mouse. So I was able to gain control over ALL of the M560 buttons!

My private.xml file for Karabiner is below and includes mappings for all the common "Mission Control" shortcuts for the two thumb buttons. The only mapping I included for the middle button is Launchpad since that seems like the only obvious function for that button. But again, you can edit the file to your liking. The hard part was figuring out the right triggers and they're all in there. You just have to change what they map to (i.e. the last line of the autogen entry).

PLEASE NOTE: You'll probably have to change the productid to match the ID of your Logitech USB receiver too. Click on Karabinder's menubar icon and then "Launch Event Viewer..." and the "Devices" tab to find the ID for your device. And one final thought... I think the deviceid is actually the unified receiver (not the mouse) so if you're using a Logitech keyboard you may be out of luck since some of these mappings will mess up your command and option keys. For instance, only thing the forward thumb button sends that a Mac can understand is the right command key! But if you're only using the M560 mouse you're good to go!

Here's my private.xml file.

    <?xml version="1.0"?>
<root>
    <item>
    <name>Logitech M560 Mouse - Macintosh Shortcuts</name>

        <!-- Middle Button - Launchpad -->
        <devicevendordef>
            <vendorname>LOGITECH</vendorname>
            <vendorid>0x046d</vendorid>
        </devicevendordef>
        <deviceproductdef>
            <productname>USB_Receiver</productname>
            <productid>0xc52b</productid>
        </deviceproductdef>
        <item>
            <name>Middle Button -> Launchpad</name>
            <identifier>private.deviceproductdef_middle_button_to_launchpad</identifier>
            <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
            <autogen>__SimultaneousKeyPresses__ 
            KeyCode::OPTION_L, KeyCode::COMMAND_L, 
            KeyCode::F4
            </autogen>
        </item>

        <item>
            <name>Tilt Wheel</name>

            <!-- M560 Tilt Left - Zoom Out -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Left -> Zoom Out</name>
                <identifier>private.deviceproductdef_tilt_left_to_zoom_out</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_L,
                    KeyCode::MINUS, ModifierFlag::COMMAND_L
                </autogen>
            </item>

            <!-- M560 Tilt Left - Scroll Left -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Left -> Scroll Left</name>
                <identifier>private.deviceproductdef_tilt_left_to_scroll_left</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_L,
                    KeyCode::CURSOR_LEFT
                </autogen>
            </item>

            <!-- M560 Tilt Right - Zoom In -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Right -> Zoom In</name>
                <identifier>private.deviceproductdef_tilt_right_to_zoom_out</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::BRACKET_RIGHT, ModifierFlag::COMMAND_L,
                    KeyCode::EQUAL, ModifierFlag::COMMAND_L
                </autogen>
            </item>

            <!-- M560 Tilt Right - Scroll Right -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Right -> Scroll Right</name>
                <identifier>private.deviceproductdef_tilt_right_to_scroll_right</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::BRACKET_RIGHT, ModifierFlag::COMMAND_L,
                    KeyCode::CURSOR_RIGHT
                </autogen>
            </item>

        </item>
        <item>
            <name>Forward Button</name>

            <!-- M560 Forward Button - Forward in Safari -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Forward in Safari</name>
                <identifier>private.deviceproductdef_forward_button_to_safari_forward</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::COMMAND_R,
                    KeyCode::BRACKET_RIGHT, ModifierFlag::COMMAND_L
                </autogen>
            </item>

            <!-- M560 Forward Button - Mission Control -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Mission Control</name>
                <identifier>private.deviceproductdef_forward_button_to_mission_control</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::COMMAND_R,
                    KeyCode::CURSOR_UP, ModifierFlag::CONTROL_L
                </autogen>
            </item>

            <!-- M560 Forward Button - Application Windows -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Application Windows</name>
                <identifier>private.deviceproductdef_forward_button_to_application_windows</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::COMMAND_R,
                    KeyCode::CURSOR_DOWN, ModifierFlag::CONTROL_L
                </autogen>
            </item>

            <!-- M560 Forward Button - Desktop -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Show Desktop</name>
                <identifier>private.deviceproductdef_forward_button_to_show_desktop</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::COMMAND_R,
                    KeyCode::F11
                </autogen>
            </item>

            <!-- M560 Forward Button - Dashboard -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Show Dashboard</name>
                <identifier>private.deviceproductdef_forward_button_to_show_dashboard</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::COMMAND_R,
                    KeyCode::F12
                </autogen>
            </item>
        </item>

        <item>
            <name>Back Button</name>

            <!-- M560 Back Button - Back in Safari -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Back in Safari</name>
                <identifier>private.deviceproductdef_back_button_to_safari_back</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::D, ModifierFlag::COMMAND_L,
                    KeyCode::BRACKET_LEFT, ModifierFlag::COMMAND_L
                </autogen>
            </item>

            <!-- M560 Back Button - Mission Control -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Mission Control</name>
                <identifier>private.deviceproductdef_back_button_to_mission_control</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::D, ModifierFlag::COMMAND_L,
                    KeyCode::CURSOR_UP, ModifierFlag::CONTROL_L
                </autogen>
            </item>

            <!-- M560 Back Button - Application Windows -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Application Windows</name>
                <identifier>private.deviceproductdef_back_button_to_application_windows</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::D, ModifierFlag::COMMAND_L,
                    KeyCode::CURSOR_DOWN, ModifierFlag::CONTROL_L
                </autogen>
            </item>

            <!-- M560 Back Button - Show Desktop -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Show Desktop</name>
                <identifier>private.deviceproductdef_back_button_to_show_desktop</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::D, ModifierFlag::COMMAND_L,
                    KeyCode::F11
                </autogen>
            </item>

            <!-- M560 Back Button - Show Dashboard -->
            <devicevendordef>
                <vendorname>LOGITECH</vendorname>
                <vendorid>0x046d</vendorid>
            </devicevendordef>
            <deviceproductdef>
                <productname>USB_Receiver</productname>
                <productid>0xc52b</productid>
            </deviceproductdef>
            <item>
                <name>Show Dashboard</name>
                <identifier>private.deviceproductdef_back_button_to_show_dashboard</identifier>
                <device_only>DeviceVendor::LOGITECH, DeviceProduct::USB_Receiver</device_only>
                <autogen>__KeyToKey__
                    KeyCode::D, ModifierFlag::COMMAND_L,
                    KeyCode::F12
                </autogen>
            </item>

        </item>
    </item>
</root>