hammerspoon2-docs
    Preparing search index...

    Function preventSleep

    • Prevents the specified type of system sleep. Creates an IOKit power assertion that stops macOS from allowing the specified type of sleep. Call allowSleep with the same type to release the assertion. idle sleep), "systemIdle" (prevent system idle sleep), "system" (prevent all system sleep, including from power button or lid close).

      Parameters

      • type: string

        The sleep type to prevent. One of: "display" (prevent display

      Returns boolean

      true if the assertion was created successfully.