detect laptop open/close from within Python?

Skip Montanaro skip.montanaro at gmail.com
Thu Apr 26 12:22:56 EDT 2018


> No idea if it'll work on your system, but on my laptop, there's a
> pseudo-file /proc/acpi/button/lid/LID0/state that has whether the lid
> is open or closed.

Thanks, I do have that. Now to figure out when it changes state...
Unfortunately, the timestamp on the file seems to update continuously,
not just on state changes. Maybe /proc/acpi/wakeup will be of some
use.

Skip


More information about the Python-list mailing list