hammerspoon2-docs
    Preparing search index...

    Function on

    • Register a listener that fires whenever the display configuration changes — monitors connected/disconnected displays, resolution or arrangement changes, or the menu bar moving to a different display.

      Parameters

      • event: "change"

        The event to listen for (the only event this module emits)

      • listener: () => void

        Called with no arguments when the display configuration changes; call all()/main()/primary() inside it to inspect the new configuration

      Returns void

      Throws an Error on failure; wrap calls in try/catch to handle it.