eventtap

Last updated last month

Tap into input events (mouse, keyboard, trackpad) for observation and possibly overriding them It also provides convenience wrappers for sending mouse and keyboard events. If you need to construct finely controlled mouse/keyboard events, see hs.eventtap.event

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

Submodules

API Overview

API Documentation

Functions

Signature

hs.eventtap.checkKeyboardModifiers([raw]) -> table

Type

Function

Description

Returns a table containing the current key modifiers being pressed or in effect at this instant for the keyboard most recently used.

Parameters

Returns

Notes

Signature

hs.eventtap.checkMouseButtons() -> table

Type

Function

Description

Returns a table containing the current mouse buttons being pressed at this instant.

Parameters

None

Returns

Notes

Signature

hs.eventtap.doubleClickInterval() -> number

Type

Function

Description

Returns the system-wide setting for the delay between two clicks, to register a double click event

Parameters

Returns

Signature

hs.eventtap.keyRepeatDelay() -> number

Type

Function

Description

Returns the system-wide setting for the delay before keyboard repeat events begin

Parameters

Returns

Signature

hs.eventtap.keyRepeatInterval() -> number

Type

Function

Description

Returns the system-wide setting for the interval between repeated keyboard events

Parameters

Returns

keyStroke

Signature

hs.eventtap.keyStroke(modifiers, character[, delay])

Type

Function

Description

Generates and emits a single keystroke event pair for the supplied keyboard modifiers and character

Parameters

Returns

Notes

Signature

hs.eventtap.keyStrokes(text)

Type

Function

Description

Generates and emits keystroke events for the supplied text

Parameters

Returns

Notes

leftClick

Signature

hs.eventtap.leftClick(point[, delay])

Type

Function

Description

Generates a left mouse click event at the specified point

Parameters

Returns

Notes

Signature

hs.eventtap.middleClick(point[, delay])

Type

Function

Description

Generates a middle mouse click event at the specified point

Parameters

Returns

Notes

Signature

hs.eventtap.otherClick(point[, delay][, button])

Type

Function

Description

Generates an "other" mouse click event at the specified point

Parameters

Returns

Notes

Signature

hs.eventtap.rightClick(point[, delay])

Type

Function

Description

Generates a right mouse click event at the specified point

Parameters

Returns

Notes

Signature

hs.eventtap.scrollWheel(offsets, modifiers, unit) -> event

Type

Function

Description

Generates and emits a scroll wheel event

Parameters

Returns

Constructors

new

Signature

hs.eventtap.new(types, fn) -> eventtap

Type

Constructor

Description

Create a new event tap object

Parameters

Returns

Notes

Methods

isEnabled

Signature

hs.eventtap:isEnabled() -> bool

Type

Method

Description

Determine whether or not an event tap object is enabled.

Parameters

Returns

start

Signature

hs.eventtap:start()

Type

Method

Description

Starts an event tap

Parameters

Returns

stop

Signature

hs.eventtap:stop()

Type

Method

Description

Stops an event tap

Parameters

Returns