Lock and unlock your KDE session based on Bluetooth device proximity.
Project description
BlueLock
Lock and unlock your KDE desktop session based on Bluetooth device proximity.
BlueLock monitors a paired Bluetooth device's signal strength. When the device moves out of range the session is locked automatically; when it returns the session is unlocked.
Features
- System tray icon with five states reflecting proximity and lock status
- Configurable RSSI thresholds with hysteresis (separate lock/unlock levels)
- Configurable time durations before acting (avoids triggering on momentary drops)
- D-Bus
org.freedesktop.ScreenSaverfor lock/unlock — no extra tools required - Optional custom lock/unlock shell commands
- RSSI smoothing with a configurable ring buffer
- Real-time signal strength display in the configuration dialog
Requirements
- Python 3.11+
- PyQt6 (
python3-pyqt6-baseon Fedora) - BlueZ (
bluez)
Installation
From source
pip install .
bluelock
Development
make run
RPM (Fedora)
make rpm
sudo rpm -i ~/rpmbuild/RPMS/noarch/bluelock-*.rpm
Usage
- Launch BlueLock — it appears in the system tray.
- Right-click the tray icon and choose Preferences.
- Click Scan to find nearby Bluetooth devices.
- Select your device and click Use.
- Adjust the lock/unlock RSSI thresholds and durations to taste.
- Click OK — monitoring begins immediately.
Tray icon states
| Icon | Meaning |
|---|---|
| Close (blue) | Device is nearby — session is unlocked |
| Far (yellow/amber) | Device is moving away — lock countdown active |
| Gone (red) | Device is absent — session is locked |
| Error (grey) | Initialising, or no signal yet |
| Paused | Monitoring is paused — no automatic lock/unlock |
Thresholds
| Setting | Description |
|---|---|
| Lock RSSI | Session locks when signal drops below this level |
| Lock duration | Signal must stay below the threshold for this many seconds before locking |
| Unlock RSSI | Session unlocks when signal rises above this level |
| Unlock duration | Signal must stay above the threshold for this many seconds before unlocking |
The gap between the lock and unlock thresholds acts as a hysteresis band, preventing the session from oscillating when you are standing right at the boundary.
Configuration file
Saved at ~/.config/bluelock/config.toml.
Development
make test # run tests
make coverage # run tests with coverage report
make lint # run ruff
make format # auto-format with ruff
make build # build wheel and sdist
make release V=X.Y.Z # tag and publish a release
License
Unlicense — public domain.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bluelock-0.4.2.tar.gz.
File metadata
- Download URL: bluelock-0.4.2.tar.gz
- Upload date:
- Size: 43.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f512108e6572b3613a5743f7fd482adcf1e49117794e96b04a70bcd94e945010
|
|
| MD5 |
7c5be7b635931796da813043ba48ec51
|
|
| BLAKE2b-256 |
ac7ee37741f967c35d6342668aa39c2bfa918ee2f93723a8185af1fbac4de4e9
|
File details
Details for the file bluelock-0.4.2-py3-none-any.whl.
File metadata
- Download URL: bluelock-0.4.2-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57805e2c02a97cc39b1b5984e850ef0d2b098d3d79ef2e1d563e38e8c78089cc
|
|
| MD5 |
0f97b25b84b7388ea8f1fabc36005b9a
|
|
| BLAKE2b-256 |
f1e5b1c981982bb3eda06f1ac4d0f37ece44848ea802f0d367f8a0c5d560edc5
|