Skip to content

Haptic Feedback

Maxmad68 edited this page Jun 19, 2020 · 1 revision

Now, PyTouchBar includes a method to perform a haptic feedback on supported Macs trackpads.

To do so, it's really easy:

import PyTouchBar.Haptic as Haptic
Haptic.perform()

Note: it sometimes doesn't work when the script only does feedback performing.

The perform method takes two (optional) arguments: the pattern level and the performance time.

Haptic.perform(pattern, time)

There are three different pattern levels (see https://developer.apple.com/documentation/appkit/nshapticfeedbackmanager/feedbackpattern):

  • Haptic.Pattern.generic
  • Haptic.Pattern.alignment
  • Haptic.Pattern.levelChange

There are three different performance time (see https://developer.apple.com/documentation/appkit/nshapticfeedbackmanager/performancetime):

  • Haptic.Time.default
  • Haptic.Time.now
  • Haptic.Time.drawCompleted

Clone this wiki locally