Created
April 15, 2025 10:20
-
-
Save billwallis/edb610e7584b6f3a480bce31ab75f1ea to your computer and use it in GitHub Desktop.
Keep screen awake script using wakepy and uv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/your-path-to/.local/bin/uv run --script | |
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "wakepy", | |
# ] | |
# /// | |
""" | |
Keep the screen awake. | |
- https://wakepy.readthedocs.io/en/stable/user-guide/index.html | |
""" | |
import datetime | |
import time | |
from wakepy import keep | |
SLEEP_TIME = 60 * 60 * 24 # 24 hours | |
def main() -> None: | |
with keep.presenting(): | |
print(f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Keeping screen awake...") | |
time.sleep(SLEEP_TIME) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment