Every had that need to lock your computer whenever you have to talk away from it. Maybe it’s a policy where you work or maybe just for security. This can come in VERY handy when you’re at an airport for example. well i set forth to solve that problem one day when I got fed-up of following the company policy of always having to lock your machine when you get up from your desk.. Being a problem solver, I thought how can I lock my machine smartly, meaning why can’t my machine detect my presence and in my absence lock itself. With that I started a journey of investigation. How can a computer detect your presence? What should it do when it can’t detect it anymore? How to programmatically lock your computer?
That research brought me to understand pybluez and ctypes. I could use pyblues to detect my phone that always on me and ctypes to lock windows. A solution was born!
I jumped into python (my favourite prototyping language) and started to code and a few minutes later – bluetooth_lock.py was born. All that was left was to schedule this little
script to run every 30 seconds or so which was achieved using windows task scheduler. You can find my tool and code on github