CGEvent doesn't allow this. you have to create an NSEvent instead, using: https://developer.apple.com/documentation/appkit/nsevent/keyevent(with:location:modifierflags:timestamp:windownumber:context:characters:charactersignoringmodifiers:isarepeat:keycode:)