A proximity-based daemon for Hyprland that triggers screen locking and unlocking through hyprlock based on Bluetooth device proximity. It monitors connected devices' signal strength to automatically control your screen lock state.
- 🔵 Bluetooth Proximity Detection: Monitors Bluetooth device signal strength to determine when to lock/unlock
- ⚡ hyprlock Integration: Uses hyprlock for actual screen locking/unlocking
- 🔄 Configurable Thresholds: Customize signal strength thresholds for locking/unlocking
- ⏱️ Adjustable Timings: Fine-tune lock/unlock hold times and polling intervals
- 🚀 Optimized Performance: Lightweight Rust implementation with minimal dependencies, efficient resource usage, and battery-friendly Bluetooth polling
- 🔌 Auto-Connect: Automatically reconnect to configured devices at specified intervals
| Package | Role |
|---|---|
Hyprland (hyprctl) |
DPMS / session integration |
| hyprlock | Screen lock |
bluez-deprecated-tools (hcitool) |
RSSI reads |
bluez (bluetoothctl) |
Connect attempts |
libnotify (notify-send) |
Optional notifications |
You can install hyprproxlock from the AUR:
yay -S hyprproxlockThis will automatically install hyprlock and bluez-deprecated-tools as a dependency.
Create a configuration file at ~/.config/hypr/hyprproxlock.conf:
# Device Configuration
device {
mac_address = "XX:XX:XX:XX:XX:XX"
name = "My Device"
enabled = true
auto_connect = true
}
device {
mac_address = "XX:XX:XX:XX:XX:XX"
name = "My Watch"
enabled = true
auto_connect = false
}
# Threshold Settings
thresholds {
lock_threshold = -25
unlock_threshold = -15
}
# Timing Configuration
timings {
lock_hold_seconds = 3
unlock_hold_seconds = 3
poll_interval = 1
reconnect_interval = 20
}
# Desktop notifications (notify-send); set enabled = false to disable
notifications {
enabled = true
}- Start the daemon:
hyprproxlock- The screen will automatically:
- 🔒 Lock (using hyprlock) when all configured devices are out of range
- 🔓 Unlock (using hyprlock) when a configured device comes back in range
To automatically start hyprproxlock when Hyprland starts, add it to your Hyprland configuration:
- Edit
~/.config/hypr/hyprland.conf:
exec-once = hyprproxlock- The tool only works when your Bluetooth is turned ON
- Your device (phone, watch, etc.) must be paired and connected
- If Bluetooth is off or no devices are connected, the tool won't do anything
- With
auto_connect = true, the tool will attempt to reconnect to devices when connectivity is lost - The
reconnect_intervalsetting controls how often reconnection attempts are made (in seconds) - Auto-connect attempts are only made for:
- Devices that are enabled in the configuration
- Devices with
auto_connect = truespecified - Devices that appear to be disconnected (no valid RSSI readings)
- This feature is useful for maintaining consistent connectivity with devices that may disconnect
- Stronger signal (higher dBm) means closer; weaker means farther
- Rough guide:
-15dBm ≈ very close,-70dBm ≈ far - Each reading falls into a zone:
| Zone | Condition | Effect |
|---|---|---|
| Disconnected | no valid RSSI | skipped for lock; may auto-connect |
| Far | rssi < lock_threshold |
lock candidate |
| Mid | between thresholds | connected; no lock/unlock action |
| Close | rssi > unlock_threshold |
unlock candidate |
- Keep
unlock_thresholdgreater thanlock_thresholdso Mid has a gap
-
When all enabled, connected devices' signals get weaker than the
lock_threshold(Far):- The tool starts a timer (set by
lock_hold_seconds) - It keeps checking the signal during this time
- Only triggers hyprlock to lock the screen if every connected device stays Far for the full timer duration
- This prevents accidental locks if you just briefly walk away
- The tool starts a timer (set by
-
The screen won't lock if:
- Bluetooth is turned off
- No devices are connected (no valid RSSI)
- Any connected device's signal is Mid or Close (stronger than
lock_threshold) - The timer hasn't completed yet
-
When any enabled device's signal gets stronger than the
unlock_threshold(Close):- The tool starts a timer (set by
unlock_hold_seconds) - It keeps checking the signal during this time
- Only unlocks the screen if that device stays Close for the full timer duration
- Unlock exits hyprlock and turns the displays back on via
hyprctlDPMS - This prevents accidental unlocks from brief signal fluctuations
- The tool starts a timer (set by
-
The screen won't unlock if:
- Bluetooth is turned off
- Your device is not connected
- No device's signal is stronger than
unlock_threshold - The timer hasn't completed yet
- Signal is polled every
poll_intervalseconds - Desktop notifications (
notify-send) report lock, unlock, and reconnect events when available andnotifications.enabledis true
| Sink | Path / stream | Level |
|---|---|---|
| File | $XDG_STATE_HOME/hyprproxlock/logs/hyprproxlock.log.YYYY-MM-DD |
INFO |
| Console | stdout when run in a terminal | DEBUG |
Typical $XDG_STATE_HOME is ~/.local/state. File logs stay focused on important events; the console includes DEBUG detail for troubleshooting.
Caution
Currently, the project uses hcitool from the bluez-deprecated-tools package for Bluetooth signal strength measurement. This is a temporary solution as attempts to use the Rust bluez implementation bluer did not return valid RSSI values. Future versions will aim to replace this with a more modern solution.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.