hammerspoon2-docs
    Preparing search index...

    Function addWatcher

    • Registers a listener that fires whenever the display configuration changes — monitors connected/disconnected, resolution or arrangement changed, or the menu bar moved to a different display. The listener receives no arguments; call all()/main()/primary() inside the callback to inspect the new configuration. The OS notification subscription starts lazily on the first listener and is released automatically when the last listener is removed.

      Parameters

      • listener: () => void

        A function called with no arguments when the display configuration changes.

      Returns void