From a683f9d976bf9a36793b40db5ef4cd878f91c523 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 3 Dec 2024 11:31:00 -0700 Subject: [PATCH] Call subprocess to lock screen --- main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.py b/main.py index e69de29..7d31967 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,15 @@ +import os, logging +DEBUG = os.environ.get('DEBUG') +logging.basicConfig( + format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s', + level=logging.DEBUG if DEBUG else logging.INFO) + +import subprocess + + +def lock_screen(): + subprocess.run(['xdg-screensaver', 'lock']) + + +if __name__ == '__main__': + lock_screen()