hammerspoon2-docs
    Preparing search index...

    Function on

    • Register a listener for host events.

      • "memoryPressure" fires when the system's memory pressure level changes (see memoryPressure()). The listener gets the new level.
      • "interfaceStyle" fires when macOS switches between its light and dark appearance (see interfaceStyle()), including automatic switches when the appearance is set to Auto. The listener gets the new style.

      Parameters

      • event: HSHostInfoEvent

        The event to listen for

      • listener: (value: "warning" | "light" | "normal" | "critical" | "dark") => void

        Called with the new memory pressure level or interface style

      Returns void

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