TMOUT will logout though, surely, not lock the screen.
There are programs that can lock the screen (one called "lock" I believe, but I don't have it). However, I'm not sure if they can be set on a timer.
But, you could easily add a timer to one of these programs by running it in a background process that would lock the screen after a certain period of time, and put a command in $pre_cmd (zsh) or $PROMPT_COMMAND (bash) that would reset the timer, e.g.
lock_screen_timer:
Code:
#!/bin/sh
echo $$ > ~/log/lock_screen.pid
sleep 5m
# lock # insert program to lock screen here
reset_lock_timer:
Code:
#!/bin/sh
kill $(<~/log/lock_screen.pid)
exec lock_screen_timer
and in ~/.bashrc
Code:
PROMPT_COMMAND=~/bin/reset_lock_timer
lock_screen_timer
So if you don't type anything for 5 mins, obviously PROMPT_COMMAND won't run so the screen will lock. A bit ad-hoc but it would do, at least until you find something better.