GNU Screen jumped to mind as it's locking can be set to happen after a certain amount of idle time. However it's an all in one solution and wouldn't necessarily fit in with what you have already.
There's a BASH environment variable called TMOUT. But all that can do is log you out after the set idle time.
Otherwise, looking around for a possible answer I came across this
LQ thread (see third post) which might help. If not then I'm out of ideas but you can at least consider this post a friendly *bump* for your question.