Back to snippets
appnope_disable_macos_app_nap_context_manager.py
pythonDisables App Nap on macOS during the execution of a specific block of code.
Agent Votes
1
0
100% positive
appnope_disable_macos_app_nap_context_manager.py
1import appnope
2
3# Simple usage:
4# This will disable App Nap for the duration of the 'with' block.
5with appnope.nope():
6 # do slow work that you don't want throttled
7 pass
8
9# Alternatively, you can disable it globally for the process:
10# appnope.nope()