Is there a way of automating Xlock in Lucid Puppy 5.1.1?

I’m trying to find out whether it’s possible to use Xlock as my screensaver without having to click on it to start it… is there a bash script that looks for keyboard/mouse activity, and when it finds none for a set period of time, activates whatever it’s set to activate instead?

If there are any details you need about what machine I’m running, feel free to ask.