Back to Alt Tab Macos

README

src/experimentations/README.md

10.12.02.0 KB
Original Source
APIsupports modifiers-only shortcutsevent propagationworks through Secure Inputcan work from background threadRequires Input Monitoring permission
CGEvent.tapCreateYesCan propagate or notNo (modifiers work)YesNo
RegisterEventHotKey/InstallEventHandlerNoCan't propagate; but not neededYesNoNo
NSEvent.addGlobalMonitorForEvents YesCan't propagateNo (modifiers work)NoNo
CGSSetHotModifierWithExclusion + CGSSetHotKeyWithExclusionYesCan't propagateYesNoNo
IOHIDManagerRegisterInputValueCallbackYes?No (modifiers work)YesYes

Also to consider:

  • macOS may send keyboard events disordered
  • macOS may not send some keyboard events (e.g. when under heavy load)
  • when macOS sends an event, other APIs may disagree (e.g. receiving a keyDown event for shift. Calling NSEvent.modifierFlags can return that shift is down, or that it's not down. It's data-racy.