mjolnir._asm.eventtap.event

Home: https://github.com/asmagill/mjolnir_asm.eventtap.event

Functionality to inspect, modify, and create events for mjolnir_asm.eventtap is provided by this module.

This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.

newkeyevent

mjolnir._asm.eventtap.event.newkeyevent(mods, key, isdown) -> event

Creates a keyboard event.

newmouseevent

mjolnir._asm.eventtap.event.newmouseevent(type, point, button) -> event

Creates a new mouse event.

properties

mjolnir._asm.eventtap.event.properties -> table

For use with mjolnir._asm.eventtap.event:{get,set}property; contains the following keys:

types

mjolnir._asm.eventtap.event.types -> table

Table for use with mjolnir._asm.eventtap.new, with the following keys:
keydown, keyup,
leftmousedown, leftmouseup, leftmousedragged,
rightmousedown, rightmouseup, rightmousedragged,
middlemousedown, middlemouseup, middlemousedragged,
mousemoved, flagschanged, scrollwheel,
tabletpointer, tabletproximity,
nullevent, tapdisabledbytimeout, tapdisabledbyuserinput

getbuttonstate

mjolnir._asm.eventtap.event:getbuttonstate(#) -> bool

Gets the state of the numbered mouse button (0-31) as down (true) or up (false). The left mouse button corresponds to 0, the right to 1, and the center to 2. The remaining buttons are specified in USB order using the integers 3 to 31.

getflags

mjolnir._asm.eventtap.event:getflags() -> table

Returns a table with any of the strings {"cmd", "alt", "shift", "ctrl", "fn"} as keys pointing to the value true

getkeycode

mjolnir._asm.eventtap.event:getkeycode() -> keycode

Gets the keycode for the given event; only applicable for key-related events. The keycode is a numeric value from the mjolnir.keycodes.map table.

getproperty

mjolnir._asm.eventtap.event:getproperty(prop) -> number

Gets the given property of the given event; prop is one of the values in the mjolnir._asm.eventtap.event.properties table; return value is a number defined here: https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/tdef/CGEventField

gettype

mjolnir._asm.eventtap.event:gettype() -> number

Gets the type of the given event; return value will be one of the values in the mjolnir._asm.eventtap.event.types table.

post

mjolnir._asm.eventtap.event:post(app = nil)

Posts the event to the system as if the user did it manually. If app is a valid application instance, posts this event only to that application (I think).

setflags

mjolnir._asm.eventtap.event:setflags(table)

The table may have any of the strings {"cmd", "alt", "shift", "ctrl", "fn"} as keys pointing to the value true

setkeycode

mjolnir._asm.eventtap.event:setkeycode(keycode)

Sets the keycode for the given event; only applicable for key-related events. The keycode is a numeric value from the mjolnir.keycodes.map table.

setproperty

mjolnir._asm.eventtap.event:setproperty(prop, value)