'Bluetooth proximity hooks on OS X. How? (i.e., automatically lock screen if I move away)

I have a macbook pro. I would like to have my screen lock when I (my phone) moves away from the laptop. I'm sure third party solutions exist, but if I'd like to code something from scratch, what libraries or hooks should I be looking at?



Solution 1:[1]

http://web.mac.com/jhollington/technocrat/The_Technocrat/Entries/2007/3/18_Bluetooth_Proximity_Detection_on_OS_X.html has a pretty good step-by-step on how to do a lot of this, although it's using an existing app. That app is open source though, so maybe this will help too? http://code.google.com/p/reduxcomputing-proximity/

Solution 2:[2]

I know it's an old question, but I've stumbled upon it today and have an answer.

Here's an opensource third-party solution: BLEUnlock

Lock/unlock your Mac with your iPhone, Apple Watch, or any other Bluetooth LE devices

It contains a modern version of all the code you need. Plus, the app itself supports hooks so you can add a hook to the app instead of writing your own.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 durin42
Solution 2 stacker-baka