Grab CGEvent for tilting scroll view

I wrote an app which (as an accessibility client) is able to grab and translate scroll wheel events. I used this functionality to translate a left-tilt to F5 and a right-tilt to F6 (which then could be configured as shortcut; e.g. to switch between Spaces etc.).


This is the code I used to capture the events (trimmed down to work in Playground):

import Cocoa
import ApplicationServices

// The event callback
private func cEventCallback(_: OpaquePointer, _: CGEventType, event: CGEvent, additionalData: UnsafeMutableRawPointer?) -> Unmanaged<CGEvent>? {
  print("Got event ", event, " with type ", event.type)
  return Unmanaged<CGEvent>.passUnretained(event)
}


// Check if the process is a trusted accessibility client
if !AXIsProcessTrusted() {
  print("Application is not a trusted Accessibility Client – crashing now^^")
  print("    (For ScrollWheelMgr to work you need to add/enable it in \"System Preferences -> Security & Privacy -> Accessibility\")")
  fatalError("Application is not a trusted Accessibility Client")
}


// Create tap and add it to runloop
let eventTap = CGEvent.tapCreate(
  tap: CGEventTapLocation.cghidEventTap,
  place: CGEventTapPlacement.headInsertEventTap,
  options: CGEventTapOptions(rawValue: UInt32(0))!,
  eventsOfInterest: CGEventMask(1 << NX_SCROLLWHEELMOVED | 1 << NX_OMOUSEDOWN),
  callback: cEventCallback,
  userInfo: nil
)
let runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, CFRunLoopMode.commonModes)

However in Catalina 10.15 Beta (19A471t) this code does not work as intended: scrolling up and down as well as a scroll-wheel clicks are still registered but tilt events are ignored now. Is there a new event mask that I can use to capture those events again?

Grab CGEvent for tilting scroll view
 
 
Q