Control and inspect the mouse pointer and attached mouse devices.
All coordinates use Hammerspoon screen coordinates: (0, 0) is at the top-left of the primary display and y increases downward.
(0, 0)
y
const pos = hs.mouse.absolutePosition()console.log("Mouse at " + pos.x + ", " + pos.y)hs.mouse.setAbsolutePosition(100, 200) Copy
const pos = hs.mouse.absolutePosition()console.log("Mouse at " + pos.x + ", " + pos.y)hs.mouse.setAbsolutePosition(100, 200)
console.log("Mice: " + hs.mouse.count())hs.mouse.names().forEach(n => console.log(n)) Copy
console.log("Mice: " + hs.mouse.count())hs.mouse.names().forEach(n => console.log(n))
console.log(hs.mouse.currentCursorType()) // e.g. "arrow"console.log(hs.mouse.scrollDirection()) // "natural" or "normal" Copy
console.log(hs.mouse.currentCursorType()) // e.g. "arrow"console.log(hs.mouse.scrollDirection()) // "natural" or "normal"
Control and inspect the mouse pointer and attached mouse devices.
Position
All coordinates use Hammerspoon screen coordinates:
(0, 0)is at the top-left of the primary display andyincreases downward.Device info
Cursor