diff --git a/MTMR/HapticFeedback.swift b/MTMR/HapticFeedback.swift index 573b350..1805fc2 100644 --- a/MTMR/HapticFeedback.swift +++ b/MTMR/HapticFeedback.swift @@ -12,44 +12,45 @@ class HapticFeedback { private var actuatorRef: CFTypeRef? private var deviceID: UInt64 = 0x200000001000000 private var error: IOReturn = 0 - + // Don't know how to do strong is enum one of - // 1 like backClick - // 2 (like Click) - // 3 (week) - // 4 (medium) - // 5 (week medium) - // 6 (strong) - // 15 (nothing) - // 16 (nothing) - + // 1 like back Click + // 2 like Click + // 3 week + // 4 medium + // 5 week medium + // 6 strong + // 15 nothing + // 16 nothing + // you can get a plist `otool -s __TEXT __tpad_act_plist /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/Current/MultitouchSupport|tail -n +3|awk -F'\t' '{print $2}'|xxd -r -p` + func tap(strong:Int32) -> Void { let actuatorRef = MTActuatorCreateFromDeviceID(deviceID).takeRetainedValue() - + // TODO: Need to fix warning guard actuatorRef != nil else { print("guard actuatorRef == nil") return } - + error = MTActuatorOpen(actuatorRef) guard error == kIOReturnSuccess else { print("guard MTActuatorOpen") return } - + error = MTActuatorActuate(actuatorRef, strong, 0, 0.0, 0.0) guard error == kIOReturnSuccess else { print("guard MTActuatorActuate") return } - + error = MTActuatorClose(actuatorRef) guard error == kIOReturnSuccess else { print("guard MTActuatorClose") return } - + return } } diff --git a/README.md b/README.md index 8839792..b1648dd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ My the idea is to create the program like a platform for plugins for customizati - [x] Time in touchbar! - [x] First the weather plugin - [x] Find how to open full-screen TouchBar without the cross and stripe menu -- [ ] Find how to add haptic feedback +- [x] Find how to add haptic feedback - [ ] JSON or another approch for save preset and plugins maybe in `~/mtmr` - [ ] Layout: [always left, NSSliderView for center, always right] - [ ] Custom buttons size, actions by click in settings