ProxLock Icon Placeholder
ProxLock is a small native utility app that runs in your macOS menu bar and allows you to automatically lock and wake up your Mac by monitoring how far away you are from it. In order to do that, it connects via Bluetooth with one of your Apple devices, such as an Apple Watch, AirPods, or iPhone.
-
When you're close to your Mac, ProxLock will attempt to wake him up and redirect you to the lock screen. At this point you either enter your password, use Touch ID or, for the most streamlined experience, use the built-in "Unlock with Apple Watch" to jump straight at the Desktop without you doing absolutely anything.
-
When you're farther away, ProxLock will lock the screen by putting Mac to sleep (black screen) or by jumping to the screensaver.
In addition to implementing the core functionalities described above, I'd like to:
- Implement a way to run user-defined scripts when ProxLock locks or unlocks Mac;
- Implement some code that removes Apple Watch from the usable devices if it's off the wrist for some reason. That could be useful in cases where the watch is charging: since it's still on, it will continue to emit a Bluetooth signal, but that is useless to infer how distant the user is from the computer (it could trigger a lock event if you move away from the charging Apple Watch!).
I took inspiration from a very cool open-source project named BLEUnlock.
- A Mac that supports Bluetooth LE and runs macOS Sequoia 15 or newer.
- iPhone >= 5s / any kind of Apple Watch / any kind of AirPods.
Build from the command line:
make buildInstall optional local formatting and linting tools:
make bootstrapThen run:
make checkInstall the recommended workspace extensions when VS Code prompts you. They provide SourceKit-LSP, SwiftFormat, and SwiftLint integration.
For this Xcode project, initialize SourceKit-LSP build settings once after make bootstrap:
make lsp-configRun ProxLock: Configure SourceKit-LSP again from VS Code after changing schemes, targets, or build settings. Build once in Xcode or with make build if SourceKit-LSP diagnostics look stale.
Swift files are formatted on save with SwiftFormat. SwiftLint fixes are applied on save where SwiftLint can safely autocorrect them.
Xcode uses the same project, SwiftFormat, and SwiftLint configuration. It does not provide reliable third-party format-on-save hooks, so use:
make format
make checkFor editor integration, install SwiftFormat's Xcode Source Editor Extension and run it manually from Xcode's Editor menu when needed.
- Fabio Colonna - fabcolonna
ProxLock is under the MIT License.