Program used to detect if the lockscreen / screensaver is active on Linux, Mac, and Windows.
Requires pip install pyobjc-framework-Quartz
from lockdetect import locked
locked()
The above will either return with False
, True
, or a None
/ reason tuple.
You can also do one of the following if you're running Linux and know the exact command from the SCREENSAVERS dictionary:
from lockdetect import locked
locked('FREEDESKTOP_SCREENSAVER')
from lockdetect import locked
locked('GNOME_SCREENSAVER')
from lockdetect import locked
locked('GNOME3_SCREENSAVER')
from lockdetect import locked
locked('KDE_SCREENSAVER')