How can I detect or be notified when windows exit the system in python?
Edit: Reply Martin v. Löwis is good and works for a complete logout, but it does not work for "quick user switching", for example, pressing win + L, for which I really need it.
Editing: im not using gui, this works as a service
source
share