I have created a small shell-script which monitors the Bluetooth space around you for a phone or other bluetooth device. If you step outside the perimeter with the device, your computer will automatically be locked. When you later walk up to your computer, it will unlock automatically.
You need bluez-utils installed. Ubuntu users can install it like this:
sudo apt-get install bluez-utils
You of course need a supported bluetooth device on your computer as well. You will need to set your bluetooth address in the script. It can be found by running hcitool scan with your phone in discovery mode. Start the script using your session manager, or manually by running a command like this:
sh bluelock.sh &
If there is demand, I will make it a proper Python application, but this works fine for me.
Note that you may want to disable the normal screensaver which usually kicks in when the computer is idle, since the script will unlock the screensaver if your phone is in proximity after a couple of seconds anyhow.
A Python version can probably be made smarter, but the real problem is that hcitool needs to be run as root to make some really cool things happen. Suid root on hcitool - acceptable?