How to set macbook trackpad programmatically?

I know there are commands of defaults can set trackpad status.

e.g:

defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 0


But there are some problems:

  1. It needs to restart computer after executing the command line.
  2. System Preferences of Trackpad do not change status of checkbox.
  3. There are some settings that are not in the settings.


These are not what I want.

Is there some way to set it programmatically?

Thanks.

Accepted Reply

Thank you very much,

I found a way to control the trackpad by capturing callbacks to events.


CGEventRef event_callback(CGEventTapProxy proxy, CGEventType type,  CGEventRef event, void *refcon);
CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0, kCGEventMaskForAllEvents, event_callback, NULL);


It meets my needs.


And I will also try to solve this problem head-on whitch.

Like switches, set the configuration of trackpad.

Replies

There seems to be only to official configuration API



Trackpad



NSPressureConfiguration

An encapsulation of the behavior and progression of a Force Touch trackpad as it responds to specific events.


NSHapticFeedbackManager

An object that provides access to the haptic feedback management attributes on a system with a Force Touch trackpad.


If that's important for your app, you could ask the question to technical support.


Thank you very much,

I found a way to control the trackpad by capturing callbacks to events.


CGEventRef event_callback(CGEventTapProxy proxy, CGEventType type,  CGEventRef event, void *refcon);
CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0, kCGEventMaskForAllEvents, event_callback, NULL);


It meets my needs.


And I will also try to solve this problem head-on whitch.

Like switches, set the configuration of trackpad.