Mac Force Touch API

83 Views Asked by At

I'm looking for a way to detect Force Touch events globally, across my Mac. I've found a code snippet that allows detection of Force Touch inside my application's window, but I have not yet found a way to detect the event outside of my application's window.

    NSEvent *(^monitor)(NSEvent *event) = ^NSEvent *(NSEvent *event) {
        NSLog(@"pressure = %f", event.pressure);
        return event;
    };

    [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskPressure
                                          handler:monitor];

Is this possible? I know BetterTouchTool can support this, after some minimal testing. Is there documentation relating to how I might go about this?

0

There are 0 best solutions below