1

SmoothMouse is the standard way to do away with the default mouse acceleration behavior imposed by the operating system.

However sometimes we find it necessary to switch it off because it interferes with some apps. The example so far is Synergy. Here's the bug: https://github.com/synergy/synergy/issues/4068

Synergy has several issues when attempting OS X <--> Windows 7 interoperation, and so far the least flaky of the setups is to have OS X be the server. For example, something about my system makes it so that iTerm2 (where all my work happens) basically can't be controlled through the Synergy client. Oops.

Anyway, in order to use Synergy we have to switch off Smoothmouse in order to not gain massive mouse acceleration gain whenever a button is held down.

The only working solution I have found so far is this method to essentially grab an executable file from an unknown author over a plaintext internet protocol:

curl -O http://ktwit.net/code/killmouseaccel; chmod +x killmouseaccel; ./killmouseaccel mouse

I did bite the bullet and ran it after I opened up the executable and saw that it's rather small (which means... absolutely nothing), so I am probably not being hacked right now. Probably.

So my question is basically, surely there is a superior method to tweak our mouse acceleration on OSX? Maybe we can try to find out how this program works and build an open-source version of it so that we don't have to literally roll the dice every time?

0

Well I did it again. I asked a question that I answered for myself by spending one second to google it.

https://github.com/docwhat/killmouseaccel

//
//  main.c
//  killmouseaccel
//
//  Created by Christian Höltje on 9/20/11.
//  This is public domain. The code was originally taken from
//  http://forums3.armagetronad.net/viewtopic.php?t=3364
//

#include <stdio.h>
#include <string.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
#include <IOKit/hidsystem/event_status_driver.h>

int main(int argc, char **argv)
{
    const int32_t accel = -0x10000; // if this ever becomes a scale factor, we set it to one
    if(argc < 2) {
        fprintf(stderr, "Give me mouse and/or trackpad as arguments\n");
        return 1;
    }

    io_connect_t handle = NXOpenEventStatus();
    if(handle) {
        int i;
        for(i=1; i<argc; i++) {
            CFStringRef type = 0;

            if(strcmp(argv[i], "mouse") == 0)
                type = CFSTR(kIOHIDMouseAccelerationType);
            else if(strcmp(argv[i], "trackpad") == 0)
                type = CFSTR(kIOHIDTrackpadAccelerationType);

            if(type && IOHIDSetParameter(handle, type, &accel, sizeof accel) != KERN_SUCCESS)
                fprintf(stderr, "Failed to kill %s accel\n", argv[i]);
        }
        NXCloseEventStatus(handle);
    } else
        fprintf(stderr, "No handle\n");

    return 0;
}

This code looks safe! So if in doubt, compile it yourself.

Still wondering if there’s a CLI command to make this happen but a C program will not be a problem.

  • I’ve updated the answer. – Steven Lu Nov 30 at 16:00
  • If you accept this answer then the "Community user" won't put it on the front page again, which is what brought it to my attention in the first place, so I suppose it has done its intended job. – Andrew Morton Nov 30 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.